繁体   English   中英

使用byteArray显示图像失败(未处理的IOErrorEvent :. text = Error#2124:加载的文件是未知类型)

[英]display image using byteArray failed (Unhandled IOErrorEvent:. text=Error #2124:Loaded file is an unknown type)

问题:将byteArray用作source时,无法显示jpeg图像。

假设有一个名为“ card”的现有图像。 <Image id="card"/> 这是场景:

1.获取bitmapData: var bitmapData:BitmapData = Bitmap(card.content).bitmapData

2.get byteArray: var pixels:ByteArray = bitmapData.getPixels(bitmapData.rect)

3.将byteArray附加到新的Image: var another:Image = new Image(); another.source = pixels. var another:Image = new Image(); another.source = pixels.

(我也尝试使用另一种方法,但仍然无法正常工作: var loader:Loader = new Loader(); loader.loader(pixels);loader.loader(pixels)将引发错误! * 错误是“未处理的IOErrorEvent :。 text = Error#2124”:加载的文件是未知类型 *

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM