Fresher4Flex
Fresher4Flex

Reputation: 38

extract and display contents of zip file in Adobe AIR

I have a requirement where my Air application loads ZIP files instead of swf. The zip contains all swf ,images and other files. My requirement is when user browses for file in a browse dialog, user selects a zip file and the contents of this zip file should be displayed to the user.

i found examples to extract zip files, but i want to know how to read te contents and display them? i am not good at programming so can someone reply me Urgently here is the exaple to extract files http://pradeek.blogspot.com/2009/05/extracting-zip-files-in-adobe-air-with.html

Upvotes: 1

Views: 2247

Answers (1)

Michał Samujło
Michał Samujło

Reputation: 368

In example you posted there is a loop which writes to disk each packaged file. Modify this loop to create list of files and display this list to user. Below is modified onDirSelect method that adds filenames to Vector.

private var files:Vector.<String>;
private function onDirSelect(e:Event):void {
    files = new Vector.<String>();
    for(var i:uint = 0; i < zipFile.entries.length; i++)
    {
     var zipEntry:ZipEntry = zipFile.entries[i] as ZipEntry;
     files.push( zipEntry.name );
    }
   }

You can find more detailed example at AS3 Zip Library homepage - http://nochump.com/blog/archives/15

Upvotes: 2

Related Questions