Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
510 views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...