如何嵌入“bmp”类型的图像进入闪光灯?
我有一个“.bmp”类型的图像(不是 jpeg 或 png)。我正在尝试使用以下代码嵌入它。
[Embed(source="images/door0091.bmp")]
private var door0091_class:Class;
private var door91:Bitmap = new door0091_class();
编译时,代码抛出以下错误。
“door0091.bmp”没有可识别的扩展名,并且未提供 mimeType 无法转码door0091.bmp。
为了克服这个问题,我尝试提供一个“mimeType”,它在运行时给出类型强制错误:
[Embed(source="images/door0091.bmp", mimeType = 'application/octet-stream')]
private var door0091_class:Class;
private var door91:Bitmap = new door0091_class();
TypeError:错误#1034:类型强制失败:无法转换DoorImages_door0091_class@3891e041到 flash.display.Bitmap。
我在谷歌中搜索过,但找不到正确的答案。 我不想将图像类型(bmp)转换为 jpeg 或 png。
有人对此有任何想法吗?请帮忙!!!
提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Flash 本身不支持 BMP 格式。如果您绝对需要图像为 bmp,则可以将图像加载/嵌入为二进制图像,然后对其进行解码。这是一个 BMP 解码器有帮助(我从未使用过)。
此博客文章 也值得检查。
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.