Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the method setPixels(rectangle, byteArray) of bitmapData in Adobe Flex

Error #2030: End of file was encountered.

This method is not working

I am using it like this

var ba:ByteArray = new ByteArray();
ba = bmd.getPixels(bmd.rect);

bmd.setPixels(srcRect, ba);
bm.bitmapData = bmd;

img.source = bm;
like image 375
Umair Avatar asked Dec 29 '25 01:12

Umair


1 Answers

You need to reset the possition of your Byte Array (ba.position = 0) before re-using it

var ba:ByteArray = new ByteArray();
ba = bmd.getPixels(bmd.rect);

ba.position = 0;
bmd.setPixels(srcRect, ba);
bm.bitmapData = bmd;

img.source = bm;
like image 141
yms Avatar answered Dec 30 '25 23:12

yms



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!