из приведенного мной примера (поправил на AS3):

Код AS3:
private function imageResize(image:Bitmap, maxWidth:Number, maxHeight:Number, allowEnlarge:Boolean = false):void
{
var ratioX:Number = maxWidth / image.width;
var ratioY:Number = maxHeight / image.height;
if (ratioX <= ratioY)
{
if (ratioX < 1 || allowEnlarge)
{
image.width = maxWidth;
image.scaleY = image.scaleX;
}
} else {
if (ratioY < 1 || allowEnlarge)
{
image.height = maxHeight;
image.scaleX = image.scaleY;
}
}
}