Symmetri Developer Blog

April 20, 2009

Export Flex UI as image?

Flash/Flex - By Shourov Bhattacharya

I have been doing some research into how it might be possible to implement a "Right Click –>Save As Image" type functionality within a Flex application. This may run up against some problems with the Flash Player security sandbox, which will generally stop your local Flex application from saving anything to the local file system unless it is first bounced off a server (Flash Player 9-).

It appears that a solution that works across all version of Flash player will definitely the help of a server page - essentially, we need to take a snapshot of a bitmap image, save to the server and then use the server as a download location for the client. There is also a "server-less" solution, but that will only work in Flash player 10.

 The table below summarizes the options:

Solution Flash Player Server? Effort? Notes
Create Bitmap data from Flex UI and bounce off a server page e.g. see this article All versions Yes High Probably best, most robust solution but will need server side development and will take time
Use FusionCharts and supported SAI functionality All versions Yes Medium/Low Good solution but needs server side development
Use new capabilities of Flex for Flash Player 10 to save image (FileReference for local file) Flash Player 10+ No Low Quickest but will not work on Flash Player 9 or less without upgrade ( about 40% of clients - see stats)
Use “hacked” solution that uses JavaScript to save on local filesystem - see example All versions but won’t work in IE! No Medium/Low Not suitable as won’t work in IE and may not work for larger images

 

Comments »

No comments yet.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.

Get free blog up and running in minutes with Blogsome
Theme designed by Janis Joseph