Trying to capture stage area using BitmapData
Posted
by Dimitree
on Stack Overflow
See other posts from Stack Overflow
or by Dimitree
Published on 2010-03-15T20:49:57Z
Indexed on
2010/03/15
21:19 UTC
Read the original article
Hit count: 343
bitmapdata
|as3
I am trying to grab part of stage area using BitmapData and copyPixels method:
bmd = new BitmapData(stage.stageWidth, stage.stageHeight);
bmdRect = new BitmapData(320, 240);
rectangle = new Rectangle(360, 20, 320, 240);
bmdRect.copyPixels(bmd, rectangle, new Point());
bmd.draw(bmp);
bmp = new Bitmap(bmdRect);
var myEncoder:JPGEncoder = new JPGEncoder(100);
var byteArray:ByteArray = myEncoder.encode(bmd);
The result i get is an empty .jpg I m pretty sure that the error is in the Bitmap procedure and not the saving one...
© Stack Overflow or respective owner