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 thi开发者_如何学运维s
var ba:ByteArray = new ByteArray();
ba = bmd.getPixels(bmd.rect);
bmd.setPixels(srcRect, ba);
bm.bitmapData = bmd;
img.source = bm;
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;
精彩评论