【问题标题】:Have Image bind to bytearray rather than bitmapasset or bitmap让 Image 绑定到 bytearray 而不是 bitmapasset 或 bitmap
【发布时间】:2011-02-15 18:54:17
【问题描述】:

我有一个存储压缩 ByteArray 版本的图像(jpg 或 png)的对象。我想保持这种方式,因为 bytearray 比它创建的 Bitmap 小大约 30 倍。我遇到的问题是当我想将图像绑定到这个字节数组时。我不能真正将它绑定到 bytearray,因为它需要 BitmapAsset 作为源。有没有办法可以从字节数组加载 BitmapAsset,但在新图像可用时仍绑定到字节数组?

【问题讨论】:

    标签: apache-flex actionscript-3 image bytearray


    【解决方案1】:

    好的,看来我可能误以为将字节数组分配给源。看起来这确实有效,并且绑定到 bytearray 将有效。

    <?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;
    }
    

    【讨论】:

    • 但即使没有,你也可以像这样使用 ChangeWatcher ChangeWatcher.watch(this, "byteArray", updateBitmapAsset);
    猜你喜欢
    • 2013-10-18
    • 2011-12-24
    • 2010-10-28
    • 2016-07-29
    • 2011-02-22
    • 2019-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多