Taking a screenshot in a SWF and encoding it is fairly straightforward:
var screen:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
screen.Draw(stage, null, null, null, new Rectangle(0, 0, stage.stageWidth, stage.stageHeight));
var encoder:PNGEncoder = new PNGEncoder();
var png:ByteArray = encoder.encode(screen);
You can replace the Rectangle
params as necessary to capture only a certain portion (e.g. your chart).
I'm going to assume you are wanting to upload the image to your server, in which case you can use a URLLoader
to send the byte array containing the encoded PNG data:
var request:URLRequest = new URLRequest(YOUR_URL);
request.contentType = "application/octet-stream";
request.method = URLRequestMethod.POST;
request.data = png;
var loader:URLLoader = new URLLoader();
loader.load(request);