I want to use FileSteam.open() to synchronously read image files from disk. I can then get them into a ByteArray with readBytes(), but I can't find how to get that into BitmapData. I know Image can read it as is, but I need BitmapData.
Any suggestions?
in the package flash.display
, use Loader::loadBytes
... that'll give you a Bitmap
, and the BitmapData
can then be simply accessed through Bitmap::bitmapData
... this makes the whole operation asynchronous, of course ... the only thing you could do, is write a decoder yourself ...
now there is a PNG encoder in AS3, in the as3corelib and i guess there are even others, but probably most people considered it pointless to write a decoder, since flash does this in its own, and also encoding is easier than decoding, because decoding means, you have to implement the whole format ... still, you can give it a shot of course ...
well, hope that helps ...
greetz
back2dos