簡體   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