ZIP it up!

Did you ever write an image gallery or a game in Flash? Did it bother you to write rather complicated load queues to load lots of small files such as image thumbnails or game assets like tiles? Are you working with big text files and need a reliable way to compress/uncompress them to save valuable bandwidth?

I’m proud to announce FZip, a cute little Actionscript 3 class i’ve been working on together with Max Herkender that enables you to load standard ZIP archives and extract contained files while the archive is still loading.

FZip is released under OSI approved zlib/libpng license.

Sample usage:

public function YourApp() {
   var request:URLRequest = new URLRequest("your.zip");
   var zip:FZip = new FZip();
   zip.addEventListener(FZipEvent.FILE_LOADED, fileCompleteHandler);
   zip.load(request);
}

private function fileCompleteHandler(evt:FZipEvent):void {
   var file:FZipFile = evt.file;
   trace("File loaded: " + file.filename)
   trace("  " + file.sizeCompressed);
   trace("  " + file.sizeUncompressed);
}

Check it out: FZip at cĂ´deazur brasil lab

5 Responses to “ZIP it up!”

  1. Campbell Says:

    Nice work guys and thankyou for the public release.

  2. Scott Barnes Says:

    You’re a deadset code freak Claus and don’t ever change ;)

    Nice work.. not find a reason to use it.. (i’ll think of one, as if we can let this good code go to waste).

  3. Zeh Says:

    Great work, Claus! I’ll have some use for this in the future…

  4. Josh Tynjala Says:

    Awesome. I can’t wait to try it out. I love the demo that loads the famfamfam icons. So simple, yet a perfect way to show the library in action.

  5. Carlos Rovira Says:

    Really useful Claus!,

    Many thank for this great resource : )