【zip编码】 import org.aszip.zip.ASZip; import org.aszip.compression.CompressionMethod; import org.aszip.saving.Method; var myZip:ASZip = new ASZip(CompressionMethod.GZIP); var txt:ByteArray = new ByteArray(); txt.writeUTFBytes("Hello there!"); myZip.addDirectory ("folder/"); myZip.addFile (bytes, "folder/haha.png"); //bytes是读取png的ByteArray myZip.addFile (txt, "folder/read.txt"); myZip.addComment ("I'm comment!"); var myZipStream:ByteArray = myZip.saveZIP(Method.LOCAL); var fileRef = new flash.net.FileReference(); fileRef.save(myZipStream, "pack.zip"); as3通过ByteArray能支持zip格式文件的解压缩和压缩操作,现在主要有: 1,Fzip:http://codeazur.com.br/lab/fzip/ 2,nochump-ziplib: http://www.nochump.com/blog/?p=15 3,ASZip: http://www.bytearray.org/?p=105 (http://code.google.com/p/aszip/) 4,ZipArchive: http://www.riaidea.com/blog/archives/35.html 实际用的时候会有一些问题,比如: 1,读取速度的考虑,一次性读出所有文件数据,还是只记录文件信息,需要时再从流读出 2,不支持中文文件名问题,需要转码,前1,2,3国外写的类支持都不好 3,文件名区分大小写问题,这样读取指定文件名的文件数据时,不能取得 zip文件格式: http://www.pkware.com/documents/casestudies/APPNOTE.TXT http://en.wikipedia.org/wiki/ZIP_(file_format)