Fork me on GitHub

AS3的一些压缩解压缩类库(AS3 ZIP、AS3 GZIP等等)

原创文章,未经允许,请勿转载

在现在开发的游戏中,由于战斗数据比较大,所以尝试对战斗数据进行压缩,然后输出到客户端flash端再解压。 Google到一篇文章,对照翻译工具翻译一下 :)

在我的一些项目中,经常需要对数据做一些转换操作,所以积累一些很有意思的用于数据压缩/解压缩的第三方类库。 当然ByteArray类本身就带了数据压缩和解压缩的方法,可以用在flash player使用zlib算法和AIR程序使用多种算法。在FLASH跟PHP作为后台的编程中,我后来选择了ByteArray的compress方法来做zlib算法的压缩,用这个方法用的比较顺手,而且很快。 下面是一些第三方的类库地址以及介绍:

  • AS3 Zip: AS 3 下用来读取和写入zip文件的类库
  • FZip: FZip 是一个用于AS 3 下读取、创建、修改zip压缩包的类库
  • ASZip: AS 3 用于创建zip文件的类库
  • LZMA Encoder: AS3下使用LZMA算法压缩数据的类库.
  • LZMA Decoder: 跟上面类库对应的用于LZMA算法解压缩数据.
  • AsCompress: AS3下 GZIP压缩和解压缩类库,好像需要SDK版本在4.x以上,flash cs3下不可用。
  • Gzip for HTTPService/URLLoader: 给你的 Flex/AIR HTTPService/URLLoader增加gzip支持
  • airxzip: AIR的zip类库

如果你还知道更多的类库或者其他好东东,欢迎告知!

翻译自://blog.yoz.sk/2011/01/quick-tip-compression-in-flash/

While working on one of my projects where I needed compression for transfered data, I hit some very interesting compression libraries. Also the ByteArray class contains compress method, using zlib algorithm in flash player or multiple algorithms in AIR. At the end I decided to useByteArray.compress() method for encoding vs. PHP gzuncompress for decoding, what works correctly, fast and smooth. Here is a list of 3rd party compression libraries and other good stuff:

  • AS3 Zip: ActionScript 3 based library for reading and writing zip files
  • FZip: FZip is an Actionscript 3 class library to load, modify and create standard ZIP archives.
  • ASZip: ActionScript 3 library to generate ZIP files
  • LZMA Encoder: AS3 class to compress data using LZMA algorithm.
  • LZMA Decoder: A part of the apparat framework.
  • GZIP: ActionScript GZIP compression library
  • Gzip for HTTPService/URLLoader: Adding Gzip support for Flex/AIR HTTPService/URLLoader
  • airxzip: Zip library for ActionScript3 on AIR

If you know some more, please let me know.

来源:悠游悠游,原文地址:https://yymmss.com/p/73.html