/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public function drawScaled(obj:DisplayObject, thumbWidth:Number, thumbHeight:Number):Bitmap { var m:Matrix = new Matrix(); m.scale(thumbWidth / obj.width, thumbHeight / obj.height); var bmp:BitmapData = new BitmapData(thumbWidth, thumbHeight, false); bmp.draw(obj, m); return new Bitmap(bmp); }
URL: http://www.nightdrops.com/2009/quick-reference-drawing-a-scaled-object-in-actionscript/
Comments
