Converting a flash chart to image / pdf
Need help in figuring out a tool which can convert a flash (.swf) chart to any image format to be later embedded to a pdf report. I am using R开发者_运维问答uby on Rails as the dev platform. I have used tools from swftools (specifically the swfextract program) but it doesn't suit my use case as it extracts individual elements (shapes, movieclips, frames etc) which is not too useful.
In addition, it would be very useful if someone can guide me on the conceptual level logic too, so that if no tool fits my bill I can write my own program
Thanks!
I would look into as3corelib from Adobe.
as3corelib
They include a library for creating / compressing PNG and JPG images directly from any DisplayObject. So, essentially you would draw your chart in flash, and initiate a function that would grab your chart, save it as a JPG / PNG and send it as a POST variable to a server side script. The classes you want to look at are listed here
If you are unable to figure out how to get this working, let me know. I have a helper class I wrote for doing a post with multipart/form-data content types. Here is what your encoding line might look like
var pngStream:ByteArray = PNGEncoder.encode(MyMovieClipsBitmapData);
Super easy! Thanks Adobe!
精彩评论