just looking for this from a long time .....
here i got it
Problem Summary
You want to take a snapshot of a Flex container or control at runtime and save it as a BitmapData object.
Solution Summary
The following example shows how you can take a snapshot of an item on the display list using the static ImageSnapshot.captureBitmapData() method, which returns a BitmapData object, as seen in the following snippet: var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(source); swfLoader.source = new Bitmap(imageBitmapData);
Explanation
In the following example, clicking the “Take snapshot of DataGrid” button uses the static ImageSnapshot.captureBitmapData() method to return a BitmapData object which in turn is converted into a Bitmap object that is loaded into a SWFLoader control:
import mx.graphics.ImageSnapshot;
private function takeSnapshot(source:IBitmapDrawable):void {
var imageBitmapData:BitmapData = ImageSnapshot.captureBitmapData(source);
swfLoader.source = new Bitmap(imageBitmapData);
}
]]>
click="takeSnapshot(dataGrid);" />
NOTE: The ability to load a ByteArray object directly into a SWFLoader control was added in Flex 3 build 187814.
For more information, see http://blog.flexexamples.com/2007/11/17/taking-screenshots-in-flex-3-using-the-imagesnapshotcapturebitmapdata-method/ and http://blog.flexexamples.com/tag/imagesnapshot/.
No comments:
Post a Comment