What's the most resources efficient way to take a screenshot of display object in as3?
This is the code I am currently using:
public static function img(o:DisplayObject,width:int,height:int):ByteArray
{
var b:BitmapData = new BitmapData(width,height,true,0x000000);
b.draw(o,new Matrix(o.width/width,0,0,o.height/height),null,null,null,true);
return new JPGEncoder(35).encode(b);
}
But it takes too much CPU power. I am okay if it will be processed more slowly, but without CPU utilization up to 60%.
Thanks.