views:

226

answers:

1

Hi,

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 Ruby 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!

+3  A: 

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!

sberry2A
Almost seemed like what I wanted but here's where I am stumbling (I've never ever done AS/flash scripting before, so please excuse me if I write anything incorrectly):The flash chart that I have are swf's - I don't have access to the source. In such a case is it possible for the flash chart to interact with as3corelib? Do I need to compile the as3corelib to make that happen? Thanks so much for the help!
Vaibhav Gumashta
You will need to load the chart swf into another swf that you create. When you have it loaded you can execute the command I have provided. You may need to consult with someone who has experience programming in Actionscript.
sberry2A
Thanks so much! Now I get it! Just to rephrase - I need to create an swf container which will load my swf charts. While creating the base swf container I can simply add the as3corelib classes to the ones that my container would have. Cool, thanks a ton! Guess I'll browse net for some quick AS tips and try myself
Vaibhav Gumashta