开发者

Have Image bind to bytearray rather than bitmapasset or bitmap

I have an object that stores the compressed ByteArray version of an image (jpg or png). I want to keep it that way as the bytearray is about 30x smaller than the Bitmap it creates. The problem I run into is when I want to bind an image to this byte array. I can't really bind it to bytearray, because it requires a BitmapAsset as a source. Is there a way I ca开发者_开发问答n load a BitmapAsset from a bytearray but still bind to the bytearray when a new image is available?


Ok, so looks like I may have misspoke about assigning a byte array to the source. It looks like this does work and binding to a bytearray will work.

<?xml version="1.0" encoding="utf-8"?>
<mx:Image xmlns:mx="http://www.adobe.com/2006/mxml"
     source="{imagePM.test}">
    <mx:Script>
        <![CDATA[
            import com.pinkhippo.model.presentation.ImageViewerPM;

            [Bindable]
            public var imagePM:ImageViewerPM;

        ]]>
    </mx:Script>
</mx:Image>

[Bindable]
public class ImageViewerPM extends EventDispatcher{

     public var test:ByteArray;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜