views:

857

answers:

2

Are you aware of any zip/unzip component or script for flash / actionscript 2 ?

I'm aware of this library for flex / AS3, but is there one for AS2 that will save me a long conversion attempt?

Is there such a library that supports creating/parsing password protected zip files?

+2  A: 

I can't say anything definitively, but I don't think this kind of library is possible in AS2. Without ByteArrays you have no binary access to data to begin with, so the only approach I can imagine is something unbelievably hackish, like reading the file in as a Bitmap and adjusting its bits with getPixel and setPixel - the mind boggles at the thought.

I think your only real options here are:

  1. to port your code to AS3 and use the library you linked
  2. Use your AS2 code with the AS3 library, via a LocalConnection bridge (this is hairy, but there are several topics on it here at SO)
  3. Do your zipping outside of Flash (for example, on the server side in PHP, etc.)
fenomas
+1  A: 

basically it can be done ... but will be slow ...

http://code.google.com/p/hxformat/

actually you would load the string and then it'll be decoded into an Array of bytes (using Bytes.ofString) ... this will take a lot of time ... and you will not be able to do a lot with the results, i guess, since AS2 api is very limited ...

you will need haXe, which is an open source language, that allows you to target lots of platforms, one of which is AVM1 ... just go to haXe.org ... and find a suitable IDE to get things compiled ...

problem is, it will be easy compiling the code, but you may have a hard time using the outcome, since haXe->swc only works for AVM2 ... but there are multiple solutions for that ...

anyway ... if possible, you should port your code to AS3, as fenomas suggested ... AS2 is really outdated, poorer as language and target's a slower VM and a much smaller API ... also, there is a lot more AS3 libs out there ... just my personal opinion ...

well, good luck anyway ... ;)

back2dos