PDA

View Full Version : Export sprite as image


gtg811a
07-29-2008, 01:59 AM
Hi, I'd like to allow my user to save a sprite they've created as an image file (just a standard jpeg or bmp, etc). I am having difficulty finding anything in the Flash documentation about this - is it simply not supported? Does anyone know how to do this?

Thanks!

lordofduct
07-29-2008, 04:36 AM
well you the flash library itself has a simple method for creating a bitmapdata of most visual things in Flash. Jpeg compression is another step that would have to be done on top of this though.

What you might want to check out is the "AS3 Core Library" which has a PNG and JPEG encoder in it. It takes care of a lot of the hard work for you.

Here is a tutorial about using it to export Jpeg images:
http://designreviver.com/tutorials/actionscript-3-jpeg-encoder-revealed-saving-images-from-flash

gtg811a
07-29-2008, 06:07 AM
This is close to the functionality that I want, but it involves client-server interaction. Is there any method for the user to save a sprite image to their hard disk without uploading/downloading from a server? After reading a few docs, I get the impression that this is not possible for security reasons. Hopefully one of you can prove me wrong :p

xxneon
07-29-2008, 10:56 AM
with the use of AIR (or other 3rd party projector) you can have it save the image to the hard drive .. but with a basic projector or embed swf you can not.