There's a lot of talk about compression in flash/AS2 here: http://www.quasimondo.com/archives/000572.php

In particular is this post:

Posted by: Grant Cox on October 19, 2005 08:35 AM

Well, I've largely completed the 64bit float packing class and the LZW class (modified from Ash's http://www.razorberry.com/blog/archives/2004/08/22/lzw-compression-methods-in-as2/ ).

The packing works well (it's tighter than a Base64 string), and it is fast enough (the unpacking on PHP is a bit slow), and, as it preserves the bytes correctly it is worthwhile to use LZW, particularly on images with gradients/flat colours.

I have provided both Actionscript and PHP classes, for packing/unpacking both bytes and multibytes into a 64bit float, and for compressing/uncompressing to LZW.

You can download the Pack64Float classes from www.ensogroup.com.au/grant/pack64float.zip

and the LZW classes from www.ensogroup.com.au/grant/LZW.zip


the pack64float is only usefull for sending to php via amfphp, but lzw could work in your case. the only problem is it outputs in binary (values 0-255), not all of which are valid characters for URLs. so you may have to do some further encoding (like base64 or something), and that may increase the size by as much or more than it was compressed by.

good luck
-David R

On 2/3/06, Henrik Lindahl <[EMAIL PROTECTED]> wrote:
Thanks, I'll have a look at that.
And yes, I am generating *long* urls. I serialize the application state
into a long string that is sent to the browser as the hash part of an
url. The idea is to be able to bookmark the app. state (and it actually
works well right now with urls around 1500 chars).
There is no real 1000 char limit, but probably a 2000 one - I've been
told IE has a 2K limit.
Right now the serialized state is about 2400 chars, but I imagine it'll
grow when more requirements are added:).
If using a backend was an option I wouldn't have to do it this way, but
unfortunately it is not. The app has to be able to run from any server,
even locally.

Cheers
/Henrik



Martin Wood wrote:
> i dont know of any actual implementations, but it sounds like it might be a good
> candidate for Huffman coding. Its not too difficult to implement. :)
>
> here's a good page here explaining how it works :
>
> http://www.cs.duke.edu/csed/poop/huff/info/
>
> and here is a page here with python code :
>
> http://gumuz.looze.net/wordpress/index.php/archives/2004/11/25/huffman-encoding/
>
> as to whether you can actually achieve that level of compression really depends
> on your input. If you absolutely must get to 25% of the input size you might
> need to consider something a bit more hardcore :)
>
> What concerns me is are you really going to generate a 1000 character url? or
> are the numbers just for demonstration purposes?
>
> thanks,
>
> Martin
>
>
> Henrik Lindahl wrote:
>
>>Hi,
>>I wonder if anyone knows of symmetric string compression librarys for AS.
>>What I'm looking for is functions to compress a string of about 4000
>>characters to something like 1000 and then be able to recreate the
>>original string. A symmetric String codec?;)
>>
>>Can this be done efficiently in AS2?
>>
>>Oh, and the encoded string must be displayable in a web browsers url;)
>>
>>Cheers
>>/Henrik
>>
>>
>>
>>_______________________________________________
>>osflash mailing list
>>[email protected]
>> http://osflash.org/mailman/listinfo/osflash_osflash.org
>>
>
>

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org

Reply via email to