Archive for November 17th, 2007

17
Nov

Taking screenshots in Flex 3 using the ImageSnapshot.captureBitmapData() method

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.

Continue reading ‘Taking screenshots in Flex 3 using the ImageSnapshot.captureBitmapData() method’

17
Nov

Changing a chart legend’s direction

The following example shows how you can change the direction of a Flex chart’s legend by setting the direction property, as seen in the following snippet:

<mx:Legend dataProvider="{lineChart}" direction="horizontal" />

Full code after the jump.

Continue reading ‘Changing a chart legend’s direction’