views:

100

answers:

1

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.

+1  A: 

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.

Juan Pablo Califano
Hi Juan. Thanks for respond.From your reply, I understand there is difficulty to embed the bmp images. I'll try to convert the images into other formats like jpeg or png. If there will be no issue with the resolution of the images, then i'll embed the converted images.Thanks for your reply!!!
sanmax007
@sanmax007. No problem. Yes, converting the images would be easier (it can be automated with programs like photoshop, for example). Plus, BMP is not a good format for web based content. It lacks good compression, so your swf will end up being quite heavy with 90 bmps, I think.
Juan Pablo Califano
Hi Juan. Yes, you are right. I've converted all images into the jpg format and now this is working fine.Thanks for showing me right direction.
sanmax007