Posted By

kajyr on 02/02/10


Tagged

scale draw actionscript3 bitmap DisplayObject


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

hERB


Drawing a scaled object in Actionscript


 / Published in: ActionScript 3
 

URL: http://www.nightdrops.com/2009/quick-reference-drawing-a-scaled-object-in-actionscript/

  1. public function drawScaled(obj:DisplayObject, thumbWidth:Number, thumbHeight:Number):Bitmap {
  2. var m:Matrix = new Matrix();
  3. m.scale(thumbWidth / obj.width, thumbHeight / obj.height);
  4. var bmp:BitmapData = new BitmapData(thumbWidth, thumbHeight, false);
  5. bmp.draw(obj, m);
  6. return new Bitmap(bmp);
  7. }

Report this snippet  

You need to login to post a comment.