简体   繁体   中英

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 .

suppose there is an existing image named "card". <Image id="card"/> . Here is the scenario:

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

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. 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! * The error is "Unhandled IOErrorEvent:. text=Error #2124":Loaded file is an unknown type *

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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