I've heard you can do this in version 8. I need to be able to export the flash stage as an image to be e-mailed to professors for an online course. Can someone lead me in the right direction?
Printable View
I've heard you can do this in version 8. I need to be able to export the flash stage as an image to be e-mailed to professors for an online course. Can someone lead me in the right direction?
First things first you need to snapshot the main timeline into an image:
Then when you want to output this as a jpeg you need to send the color of every single pixel to a server-side script which will then build a bitmap file on the server and apply jpeg compression.Code:import flash.display.BitmapData
var b = new BitmapData(Stage.width,Stage.height)
b.draw(_root)
You will be sending quite alot of data over the wire so this could take some time and you will also need to send using HTTP POST.
I would personally use php and the GD Image Library for the server-side.
There are potentially alot of pixels that you will need to loop through. Flash will most probably display a "This script is running slowly" if you loop over the pixels all on one frame. So i suggest that you loop over the pixels over a number of frames.
You can use:
To get the color of the pixel as the specified location.Code:b.getPixel(x,y)