Jump to content
Software FX Community

Help: ChartFX generate a Flash .swf file?


Recommended Posts


 Consider the following code snippet to generate a Flash (*.swf) file.

  Chart chart = new Chart();   chart.getData().setSeries(2);   chart.getData().setPoints(5);   chart.setGallery(Gallery.LINES);   chart.setWidth(500);   chart.setHeight(200);   chart.setRenderFormat("Flash"); //$NON-NLS-1$   chart.setOutputWriter(new FlashWriter());   OutputStream os = new FileOutputStream(C:\\charts\\chart.swf"); //$NON-NLS-1$   Writer imgMap = new FileWriter("C:\\charts\\imgMap.txt"); //$NON-NLS-1$   Writer htmlTag = new FileWriter("C:\\charts\\htmlTag.txt"); //$NON-NLS-1$   chart.renderToStream(os, imgMap, htmlTag);   htmlTag.close();   imgMap.close();   os.close();



There is indeed a "chart.swf" file generated in that directory. I've attached it for reference. The problem is the SWF file is corrupt or invalid, and cannot be opened with a web browser. 

I understand the three-argument version of renderToStream() is generating Flash bitstream data. Does this bitstream need more encoding before it is a valid SWF file? If so, how?

I figured I could generate a SWF file easily, but apparently not. Any help greatly appreciated. :)
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...