Reputation: 1631
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.
(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*
Upvotes: 0
Views: 2192
Reputation: 2288
Refer below links...
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/
Upvotes: 1