Bingo! I've put together a hack that shows this is possible. I tried
doing this with Python, but then I noticed php has the same features
and I'm no good with Python.
Here's how to do it. Make a php file that uses "gzcompress", something
like this...
header('Content-Type: application/octet-stream');
print gzcompress("this is a test string",9);
Run the page through your browser and save the file somewhere. Then
create a class that opens and uncompress()'s the file. It seriously
works. I'm posting my sample here, I hope email doesn't mangle it.
package {
import flash.events.Event;
import flash.net.URLLoader;
import flash.net.URLLoaderDataFormat;
import flash.net.URLRequest;
import flash.utils.ByteArray;
import flash.events.Event;
import flash.events.IOErrorEvent;
public class Testify {
static private var url:String = "testfile";
private var urlLoader:URLLoader;
public function Testify() {
trace("Loading "+url);
urlLoader = new URLLoader();
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.addEventListener(Event.COMPLETE,onComplete);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR,onError);
urlLoader.load(new URLRequest(wadUrl));
}
private function onComplete(e:Event):void {
trace("Loaded");
var data:ByteArray = urlLoader.data;
urlLoader.data = null;
urlLoader.close();
urlLoader = null;
data.uncompress();
data.position = 0;
trace(data.readUTFBytes(data.bytesAvailable));
}
private function onError(e:Event):void {
trace("Error");
}
}
}
It worked for me. Zlib files are a standard I suppose, any language
with access to zlib could probably pull it off.
Also, Claus, I didn't think of that at all, if you could create a
flash-compatible zip file a wide range of assets could be compressed
into a single file and decompressed within Flash. That's easily the
most intriguing idea I've heard yet.
_______________________________________________
[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