convert an encoded string to jpg and display it
I need to convert a base64 encoded string from a server (being sent via amf) to an image. on the server the raw image data (gif / jpeg / png) is being encoded to base64 (which already works fine), and I need to decode this str开发者_Go百科ing and display the image in my flash movie. How can this be done?
After you've converted your string to a ByteArray, you can create a Loader object and use LoadBytes to turn your binary object into a display object. Then add the loader to stage.
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.loadBytes(yourBytesHere)
function completeHandler(e:Event):void {
addChild(loader);
}
convert it to ByteArray
if you need saving: as3corelib package com.adobe.images.*
精彩评论