Loading .bmp (Bitmap) and .tiff file in Flash 10 using a Loader

跟風遠走 提交于 2019-11-28 02:25:58

问题


I am developing a Image uploader using Flash 10. I am using FileReference object to browse images and Loader to show the image:

Sample code:

var tempFileRef:FileReference = FileReference(ev.target);
var oLoader:Loader = new Loader();
oLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onImageLoad);
oLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
oLoader.loadBytes(tempFileRef.data);

It works fine with .jpg and .gif files but when I browse .bmp or .tiff file, I am getting the error:

Error #2124: Loaded file is an unknown type.

Is there a way to load and display browsed .bmp images from desktop?

Thanks


回答1:


BMPDecoder class from Spark lib: http://www.libspark.org/svn/as3/BMPDecoder/src/com/voidelement/images/BMPDecoder.as

Example of the usage: http://hi.baidu.com/leyhui/blog/item/d12be8b116ec915308230298.html

Regarding TIFFDecoder, it is still work in progress, but very promising one:

http://code.google.com/p/windowsbitmapdencoder/




回答2:


No. Flash does not support .bmp and .tiff files.

Adobe Help Docs

"The bitmap image formats supported by Adobe Flash Player are GIF, JPG, and PNG."



来源:https://stackoverflow.com/questions/2106195/loading-bmp-bitmap-and-tiff-file-in-flash-10-using-a-loader

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!