Turn image into image in Flex

Using Flex 3, I would like to take a snapshot of the image, for example:

var logoSnapshot:ImageSnapshot = ImageSnapshot.captureImage(logoContainer);

and turn it into something that the Image class can use. I see that there is a property called "data" that contains a byte array, so I guess my question is: how to take an image to be stored as byteArray and convert it to something that the Image class can display? / P>

+3
source share
4 answers

A simplified implementation that should work:

var bm : Bitmap = new Bitmap(ImageSnapshot.captureBitmapData(logoContainer));

Set "bm" as the source of your Image object.

+2
source

The BitmapData class has:

public function setPixels(rect:Rectangle, inputByteArray:ByteArray):void

, .

BitmapData .

0

, .

, ByteArray setPixels(). , int, 32- ARGB. ByteArray , . , JPG, PNG GIF, ByteArray source , Flash Player , .

0

In fact, you can simply set ByteArray directly as the source property of the Image class in the current Flex SDK.

0
source

Source: https://habr.com/ru/post/1707809/


All Articles