Zlib (Flash) uses an ADLER32 checksum, see RFC 1950 [1], whereas zip
uses CRC-32 [2]. The checksum is calculated over the uncompressed file
so imho it's impossible to uncompress a file in a 3rd party created zip
archive (you don't have the ADLER32 checksum that Flash needs - the dog
bites its tail there), which really is a pity.

Yeah, the same think happened with gzip for me. I wasn't aware that
Adler32 was being used though, thanks.

    No need, you can do this now. If you gzip a file and send it via post
response (sendAndLoad), the browser will decompress it for you automatically
(as long as the header says it's compressed). I implemented it in an app I
built almost 2 years ago, where all XML data from the server was compressed.
The only downside is that you lose the ability to getBytesLoaded, because
the browser can't uncompress the file until it is completely loaded, and
flash doesn't get any of the file until it is uncompressed.

Yeah but only so many browsers support this, IE6 doesn't, that's 90%
of the Internet right there.

    The problem there is that the CPU power required to zip any sizeable
amount of data with any reasonably good compression scheme will bring the
Flash player to its knees. And if the data isn't that large, it doesn't
really need to be compressed, does it? I, too, am working on some
compression classes, but I'm pretty busy with other stuff right now and
haven't had time lately to mess with it.


Not as much as you'd think (I think), flash files are commonly
compressed themselves, and it's not much for Flash to decompress them
on the spot. It's not as if I'm not expecting a little extra "loading
time" here, but I'm not writing the decompressor in Actionscript, the
whole point of this is to make Flash do the hard work.

>
    I wrote an RLE class a while back, but it's not useful for anything
large, and for smaller stuff the compression isn't that great. And you would
also have to write the same class on the server side if you wanted to use it
anywhere but flash. It's mostly useful for storing large, repetitive blocks
of text for reuse in Flash later.


Personally the ideal situation for me would be a customized version of
something like gzip, only one that provided the proper checksums that
Flash wants. Expecting the server to compress this might be too much,
all i had in mind were pre-compressed files. Choosing whether or not
to compress them is a choice based on the advantages versus the
disadvantages. In my case it's a huge advantage, since even the
fastest compression shrinks my particular file by 60%, I'm sure most
huge text/xml files could easily beat that.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to