Question

I have an image of type '.bmp' (NOT jpeg or png). I am trying to embed it using the following code.

[Embed(source="images/door0091.bmp")] 
private var door0091_class:Class; 
private var door91:Bitmap = new door0091_class();

On compiling, the code throws following error.

'door0091.bmp' does not have a recognized extension, and a mimeType was not provided Unable to transcode door0091.bmp.

To overcome that I tried to give a 'mimeType' which is giving a type coercion error during runtime:

[Embed(source="images/door0091.bmp", mimeType = 'application/octet-stream')] 
private var door0091_class:Class; 
private var door91:Bitmap = new door0091_class();

TypeError: Error #1034: Type Coercion failed: cannot convert DoorImages_door0091_class@3891e041 to flash.display.Bitmap.

I've searched in the google, but I am not able to find the correct answer. I don't want to convert the image type(bmp) to jpeg or png.

Anyone have any idea about this?? Please help!!!

Thanks in advance.

Was it helpful?

Solution

The BMP format is not supported by flash natively. If you absolutely need your images to be bmps, you could load/embed the images as binary, then decode them. Here's a BMP decoder that might be of help (I've never used it).

This blog post could also be worth checking.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top