How do I get the BitmapData from a local image in Flex?
The image is already held locally on the client PC and it is an Air application. The image is not embedded, it is in the Application Storage directory.
I have seen this question: How can i get a BitmapData object out of a File object from a 开发者_StackOverflowlocal jpeg file in AIR? but it uses URLRequest which I don't think is what I need because the file is local.
Using file.url will give you a url you can use with a URLRequest even though the file is local.
Did you try reading the image file using FileStream
class's readBytes()
method? This will give you a ByteArray
representation of the image. I think you can create a new BitmapData
Object using this info. I haven't tested this myself.
精彩评论