ZIP compression of non-binary 3d content files

Software: Away3D 4.x

frukc, Newbie
Posted: 08 March 2012 10:38 PM   Total Posts: 8

would it be difficult to implement this in Loader module? like - if I load ‘’ loader would unzip file first and then pass it to correstponding parser. as3 compression libraries are available for long time now, ‘text’ format 3d files are perfect for compression and grow huge, without it.
or maybe there allready is feature like this?


loth, Sr. Member
Posted: 09 March 2012 12:06 AM   Total Posts: 236   [ # 1 ]

i use fzip and ByteArray something like this


File Attachments  (File Size: 5KB - Downloads: 741)

jtopaz, Member
Posted: 09 March 2012 10:05 AM   Total Posts: 53   [ # 2 ]

For .obj format, if we only zip the .obj file, how it handle the .mtl file and it’s texture image file?



loth, Sr. Member
Posted: 09 March 2012 10:15 AM   Total Posts: 236   [ # 3 ]

simply i don’t use .mtl i creat new texture for all
and in fact .obj is biger than .3ds
but .obj have better support of smoothing group



frukc, Newbie
Posted: 09 March 2012 10:42 AM   Total Posts: 8   [ # 4 ]

.mtl and texture files are handled as before. i had no problems with them.
my solution was to modify “” in loaders/misc/

by adding zip libraries…


and a little bit of code…

private function handleUrlLoaderComplete(event Event) : void
var urlLoader URLLoader URLLoader(event.currentTarget);
///////////////////// added
if (_req.url.toLowerCase().indexOf("zip") > -1)
var myZipFile:ZipFile = new ZipFile(;
_data myZipFile.getInput(myZipFile.getEntry(myZipFile.entries[0]));
///////////////////// end added
   //_data =;

in project code i changed:

myLoader.load(new URLRequest('../lib/MODEL.obj')); 


myLoader.load(new URLRequest('../lib/')); 

(zip file contains single file - same ‘MODEL.obj’)

and all worked fine from that point! including .mtl and texture file loading (zipped is just .obj file) smile



frukc, Newbie
Posted: 09 March 2012 10:50 AM   Total Posts: 8   [ # 5 ]

p.s. reduction in size of OBJ file by zipping was 81% from 1.8Mb to 0.37Mb cool smirk



loth, Sr. Member
Posted: 09 March 2012 11:47 AM   Total Posts: 236   [ # 6 ]

same for .3ds



loth, Sr. Member
Posted: 09 March 2012 04:50 PM   Total Posts: 236   [ # 7 ]

i make basic tutorial about that
i add texture after


File Attachments  (File Size: 675KB - Downloads: 456)

frukc, Newbie
Posted: 09 March 2012 11:39 PM   Total Posts: 8   [ # 8 ]

good! can’t take a look at it now, but i guess, some as3 folks will appreciate your effort.



C., Newbie
Posted: 03 April 2012 06:48 PM   Total Posts: 9   [ # 9 ]

Hey guys,

Thats a really interesting topic. Exactly what I was looking for! Has anyone tried already to load the images from the zip file as well? So that you only have to upload a single file, including all assets.

Somehow I couldnt manage to get the JPG in the loader again. I assume it should work with assetLoaderContext. But I dont know how to do that exactly.

My approach was something like this:

else if (product.substring(product.length 4product.length).toLowerCase() == ".zip"{
var urlstream:URLStream = new URLStream();
urlstream.load(new URLRequest(product));


private function zipCompleteHandler(event:Event):void
var datastream:URLStream URLStream(;
zipFile:ZipFile = new ZipFile(datastream);
assetcontext:AssetLoaderContext = new AssetLoaderContext(true);
zipImages = new Array();
data3ds:ByteArray = new ByteArray();
   for (var 
i:int 0zipFile.entries.lengthi++)
var entry:ZipEntry zipFile.entries[i];
    if ( == ".3ds")
//if 3ds
data3ds zipFile.getInput(entry);
trace("3ds-Url: ";
else if ( == "/" || == "\\")
//if folder-> do nothing
trace("Folder Url: ";
// images

zipImages[] tempLoader.loadBytes(zipFile.getInput(entry));
trace("Image Url: ";
.loadData(data3dsassetcontextnull, new Max3DSParser());

Do I have to convert the Image from Bytearray back to jpg before putting it in assetloadercontext? If so, how do I do that?

Thanks a lot! smile

Best regards



loth, Sr. Member
Posted: 03 April 2012 11:47 PM   Total Posts: 236   [ # 10 ]

jpg are already compress
compress them is a nonsense
i think



C., Newbie
Posted: 04 April 2012 07:19 AM   Total Posts: 9   [ # 11 ]

Of course you are right and I have to admit that using JPG was a stupid example. But for BMP and PNG it would make sense. smile

Also I like the idea of having all assets in just one zip-file to load from instead of several folders.



loth, Sr. Member
Posted: 04 April 2012 09:40 AM   Total Posts: 236   [ # 12 ]

for png is the same no compression and bmp not in flash

look at fzip codazure website they are a simple exemple
with 1000 icons



manlypullock, Newbie
Posted: 28 October 2015 05:58 AM   Total Posts: 1   [ # 13 ]

Check this one…..7-Zip 9.20



‹‹ Please add layers.


Away3D Forum

Member Login