From the category archives:

ImageSnapshot

The following example shows how you can use the FileReference class’s new save() method in Flash Player 10 to save text, XML, and image files to a user’s hard drive.

Full code after the jump.

[click to continue…]

{ 23 comments }

The following example shows how you can set the ImageSnapshot class’s static defaultEncoder property in Flex 3 to set a default image encoder for captured images.

Full code after the jump.

[click to continue…]

{ 6 comments }

The following example shows how you can use the ImageSnapshot class to capture images as JPEGs or PNGs by setting the encoder parameter in the ImageSnapshot class’s static captureImage() method in Flex 3.

Full code after the jump.

[click to continue…]

{ 5 comments }

The following example shows how you can convert an ImageSnapshot object into a Base-64 encoded string using Flex 3’s cleverly named encodeImageAsBase64() method.

Full code after the jump.

[click to continue…]

{ 0 comments }

As we saw in a previous entry, “Taking screenshots in Flex 3 using the ImageSnapshot.captureImage() method”, it is possible to take a screenshot of an item on the display list using the static ImageCapture.captureImage() method. Once the image is captured, we accessed the image’s pixel data using the ImageCapture object’s data property, which was displayed using the SWFLoader control.

The ability to load a ByteArray object directly into a SWFLoader was added in Flex 3 build 187814, you may need to update your SDK build by downloading a recent nightly build from http://labs.adobe.com/technologies/flex/sdk/flex3sdk.html.

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);

Full code after the jump.

[click to continue…]

{ 0 comments }

The following example shows how you can use the static captureImage() method in the mx.graphics.ImageSnapshot class to take a screenshot of an item on the display list, convert it into a ByteArray, and display the ByteArray using a SWFLoader control.

Full code after the jump.

[click to continue…]

{ 31 comments }