|
AirBase64 ANE for Base64 Support (iOS, Android & Destkop) I created this ANE because decoding and encoding ByteArray or BitmapData to Base64 on mobile devices is very slow using regular AS3. It should work on iOS, Android and Desktop. I'm working on Blackberry version. InstallationThe ANE binary (AirBase64.ane) is located in the bin folder. You should add it to your application project's Build Path and make sure to package it with your app (more information here). UsageJust call the static methods Encode / Decode ByteArray - var myByteArray:ByteArray = new ByteArray();
- myByteArray.writeUTFBytes("I need some tacos!");
- var base64str:String = AirBase64.encodeByteArray(myByteArray);
- trace (base64str);
- var myNewByteArray:ByteArray = AirBase64.decodeByteArray(base64str);
- trace (myNewByteArray.readUTF());
复制代码 Encode / Decode BitmapData
- var myBitmapData:BitmapData = new BitmapData(100, 100);
- var base64str:String = AirBase64.encodeBitmapData(myBitmapData);
- trace (base64str);
- var myNewBitmapData:ByteArray = AirBase64.decodeBitmapData(base64str);
复制代码 Build scriptIf you need to edit the extension source code and/or recompile it, you will find a shell.sh script to make it easy and you just need to edit the Flash Builder path. AuthorThis ANE has been written by Daniel Fernández. It belongs to me and is distributed under the Apache Licence, version 2.0.
相关链接:
https://github.com/tangamampilia/AirBase64
|