I've been having no luck getting Flex to decompress some data I've compressed using a tool based on zlib. I've tried the same code using AIR where I can specify the compression method and the data *does* decompress correctly. Below is a bit of code to give the idea:
public function onComplete(event:Event) : void{ var loader:URLLoader = URLLoader(event.target); //var info:String = loader.data; //trace(info); var ba:ByteArray = new ByteArray; ba = loader.data as ByteArray; ba.position = 0; // The next line of code fails with error #2058 every time using Flex. // Under AIR - you can get it to work by specifying the decompression method as DEFLATE. ba.uncompress(); // For the AIR application, the line above is // ba.uncompress(CompressionAlgorithm.DEFLATE); var bytes:String = bytes = ba.toString(); Alert.show(bytes.toString()); // AIR shows the original string, Flex never gets this far. } A couple of questions: * Does it matter what MIME type is set on the Web server for the content? If so, what MIME type is likely to work. * What decompression method exactly does the Flash player support? I've read "deflate" - which AIR seems to handle when I specify DEFLATE. * Perhaps there's something messed up in my compression data - would someone be willing to post some kind of 'hello world' in plain text and compressed form that is known to work with ByteArray.uncompress()? >From there, I can experiment and see if I can tinker with my compression settings (or switch compression libraries) until I get a match. Thanks in advance for any help.