[英]display image using byteArray failed (Unhandled IOErrorEvent:. text=Error #2124:Loaded file is an unknown type)
Problem:can't display jpeg image when using the byteArray as source
. 问题:将byteArray用作
source
时,无法显示jpeg图像。
suppose there is an existing image named "card". 假设有一个名为“ card”的现有图像。
<Image id="card"/>
. <Image id="card"/>
。 Here is the scenario: 这是场景:
1.get bitmapData: var bitmapData:BitmapData = Bitmap(card.content).bitmapData
1.获取bitmapData:
var bitmapData:BitmapData = Bitmap(card.content).bitmapData
2.get byteArray: var pixels:ByteArray = bitmapData.getPixels(bitmapData.rect)
2.get byteArray:
var pixels:ByteArray = bitmapData.getPixels(bitmapData.rect)
3.attach the byteArray to an new Image: var another:Image = new Image(); another.source = pixels.
3.将byteArray附加到新的Image:
var another:Image = new Image(); another.source = pixels.
var another:Image = new Image(); another.source = pixels.
(I also tried to use another way, still can't work: var loader:Loader = new Loader(); loader.loader(pixels);
) loader.loader(pixels) will throw an error! (我也尝试使用另一种方法,但仍然无法正常工作:
var loader:Loader = new Loader(); loader.loader(pixels);
) loader.loader(pixels)将引发错误! * The error is "Unhandled IOErrorEvent:. text=Error #2124":Loaded file is an unknown type * * 错误是“未处理的IOErrorEvent :。 text = Error#2124”:加载的文件是未知类型 *
Refer below links... 请参阅以下链接...
http://cookbooks.adobe.com/post_Loading_a_local_file_to_a_byte_array_in_Flash_Play-16715.html http://cookbooks.adobe.com/post_Loading_a_local_file_to_a_byte_array_in_Flash_Play-16715.html
http://blog.yoz.sk/2009/10/bitmap-bitmapdata-bytearray/ http://blog.yoz.sk/2009/10/bitmap-bitmapdata-bytearray/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.