First things first you need to snapshot the main timeline into an image:
Code:
import flash.display.BitmapData
var b = new BitmapData(Stage.width,Stage.height)
b.draw(_root)
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.
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.