/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static function getBitmapData(target:DisplayObjectContainer) : BitmapData { var bounds : Rectangle = new Rectangle(); bounds = target.getBounds(target); var matrix : Matrix = new Matrix(1, 0, 0, 1, 0 - bounds.x, 0 - bounds.y); matrix.scale(1, 1); //for png data set the transparent to true, otherwise just leave as false var bmd : BitmapData = new BitmapData(bounds.width, bounds.height, true); bmd.draw(target, matrix, null, null, null, true); return bmd; }