Return to Snippet

Revision: 23249
at February 2, 2010 04:40 by kajyr


Initial Code
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);
}

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

Initial Description

                                

Initial Title
Drawing a scaled object in Actionscript

Initial Tags

                                

Initial Language
ActionScript 3