Posted By

arpo on 02/17/09


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

muoto


Take snapshot of movieclip/sprite


 / Published in: ActionScript 3
 

  1. import flash.display.Bitmap;
  2. import flash.display.BitmapData;
  3. import flash.display.DisplayObject;
  4. import flash.geom.Matrix;
  5.  
  6. addChild(snapShot(sourceMc)); //sourceMc the name of the MC to take snapshot of
  7.  
  8. private function snapShot(mc:DisplayObject, scale:Number = 1):Bitmap{
  9.  
  10. var m:Matrix = new Matrix();
  11. m.scale (scale,scale);
  12. var bmpData:BitmapData = new BitmapData(mc.width, mc.height, true, 0x00000000);
  13. bmpData.draw (mc,m);
  14. var bmp:Bitmap = new Bitmap(bmpData);
  15. return bmp;
  16.  
  17. }

Report this snippet  

You need to login to post a comment.