Yangbo's Blog!

Artificial Intelligence Board Game.

Take a snapshot of Flex app,anyplace,anysize!

June30

Once upon a time.I found in flex we can use ImageSnapShot to snapshot some pictures from a flex component container.(reference:Taking a snapshot of Flex app, from Flex!)but as much as ever? fixed component size, fixed component position?
And now.I had seen somewhere is possible.It could locate how extractly it was to be done.very easy to do such a screen capture / screen grab using Flex in flashplayer.

The essential steps are:
* Create a new BitmapData object(Application.application.stage).
* Copy the target component's(here is ResizeableTitleWindow.snappedArea(Canvas)) pixel data into BitmapData object.
* Convert the BitmapData object to a PNG encoded ByteArray (using the PNGEnc library)
* Convert the ByteArray to a Base64Encoded string so that we can send the data safely to the backend.
* On the backend (PHP(RAW_DATA)), decode the data and write it to a file.
ps:via PopUp ResizeableTitleWindow to move SnapshotComponent to anywhere,to zoom anysize;using Degrafa RasterTextPlug to rotate (not embed fonts) TextField;

here is the demo:(Flex+Mate Framework+UndoRedoFramework+Degrafa via simple PHP)

Get Adobe Flash player

here is the source:

posted under Flex/AS3/Flash, Mate, PHP
2 Comments to

“Take a snapshot of Flex app,anyplace,anysize!”

  1. Avatar September 30th, 2009 at 1:10 Kelli Garner Says:

    Thats very good to know… thanks


  2. Avatar November 27th, 2009 at 22:56 James Fish Says:

    Really like this site, would you mind if I link to it from my blog?


Email will not be published

Website example

Your Comment:

 

BLOG CALENDAR

July 2010
M T W T F S S
« Apr    
 1234
567891011
12131415161718
19202122232425
262728293031