Guest User

Untitled

a guest
Aug 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. Issue when creating bitmap from a movie clip in AS3
  2. import flash.geom.Matrix;
  3. import flash.display.BitmapData;
  4. import flash.display.Bitmap;
  5.  
  6. var box1:Box = new Box();
  7. box1.x = 100;
  8. box1.y = 20;
  9. addChild( box1 );
  10. box1.scaleX *= -1;
  11.  
  12. var box2:Box = new Box();
  13. box2.x = 300;
  14. box2.y = 20;
  15. addChild( box2 );
  16.  
  17. var matrix:Matrix = new Matrix( 1, 0, 0, 1, (box1.width / 2), (box1.height / 2) );
  18.  
  19. var bitmapData:BitmapData = new BitmapData( box1.width, box1.height, true, 0xFFFFFF);
  20. bitmapData.draw(box1, matrix, null, null, null, true);
  21.  
  22.  
  23. var bitmap:Bitmap = new Bitmap( bitmapData );
  24. addChild( bitmap );
  25. bitmap.x = 400;
  26. bitmap.y = 300;
  27.  
  28. var myMatrix:Matrix = myDisplayObject.transform.matrix;
  29. myMatrix.scale(1,-1);
  30. myDisplayObject.transform.matrix = myMatrix;
  31.  
  32. var bitmapData:BitmapData = new BitmapData( box1.width, box1.height, true, 0xFFFFFF);
  33. bitmapData.draw(box1, myMatrix, null, null, null, true);
  34.  
  35. var matrix:Matrix = new Matrix( 1, 0, 0, 1, -(box1.width / 2), (box1.height / 2) );
Add Comment
Please, Sign In to add comment