/**
* resize image to fit in a rectangle */ public function resizeToFit(mc : MovieClip, width : Number, height : Number) : void { var largeWidth : Number = mc.width; var largeHeight : Number = mc.height;
initialContainerWidth = largeWidth; initialContainerHeight = largeHeight;
mc.width = int((fitPercent / 100) * largeWidth); mc.height = int((fitPercent / 100) * largeHeight); mc.x = Math.round((componentWidth - mc.width) / 2); mc.y = Math.round((componentHeight - mc.height) / 2); }