Posted By

ninjaparade on 11/25/10


Tagged

data flash as3 bitmap


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

alptugan
tspitzr
tombarc
thastyle


Get bitmap data dynamically


 / Published in: ActionScript 3
 

  1. public static function getBitmapData(target:DisplayObjectContainer) : BitmapData
  2. {
  3. var bounds : Rectangle = new Rectangle();
  4. bounds = target.getBounds(target);
  5. var matrix : Matrix = new Matrix(1, 0, 0, 1, 0 - bounds.x, 0 - bounds.y);
  6. matrix.scale(1, 1);
  7. //for png data set the transparent to true, otherwise just leave as false
  8. var bmd : BitmapData = new BitmapData(bounds.width, bounds.height, true);
  9. bmd.draw(target, matrix, null, null, null, true);
  10. return bmd;
  11. }

Report this snippet  

You need to login to post a comment.