开发者

convert an encoded string to jpg and display it

开发者 https://www.devze.com 2023-01-28 16:42 出处:网络
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 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.*

0

精彩评论

暂无评论...
验证码 换一张
取 消