/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function snapClip( clip:DisplayObject ):BitmapData { var bounds:Rectangle = clip.getBounds( clip ); var bitmap:BitmapData = new BitmapData( int( bounds.width + 0.5 ), int( bounds.height + 0.5 ), true, 0 ); bitmap.draw( clip, new Matrix(1,0,0,1,-bounds.x,-bounds.y) ); return bitmap; }