Bitmap Snapshots of DisplayObjects


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function snapClip( clip:DisplayObject ):BitmapData
  2. {
  3. var bounds:Rectangle = clip.getBounds( clip );
  4. var bitmap:BitmapData = new BitmapData( int( bounds.width + 0.5 ), int( bounds.height + 0.5 ), true, 0 );
  5. bitmap.draw( clip, new Matrix(1,0,0,1,-bounds.x,-bounds.y) );
  6. return bitmap;
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.