//TODO: missbehaves on rectangular images? //http://wordpress.org/support/topic/square-images-cropped-in-fullscreen?replies=7#post-2227942 function fitToScreen(mc:MovieClip) { var maxHeight:Number = Stage.height-25; ZigoEngine.doTween (mc,"_x",0,0,"linear",0,function () { if(mc._height <= maxHeight && mc._width <= Stage.width){ mc._yscale = mc._xscale = 100; } if(_scalingStrategy != _NOSCALE){ if(mc._height < mc._width) { mc._width = Stage.width; mc._yscale = mc._xscale; if(_scalingStrategy == _FILL){ if (mc._height < maxHeight) { mc._height = maxHeight; mc._xscale = mc._yscale; } } }else { mc._height = maxHeight; mc._xscale = mc._yscale; } } mc._x = Stage.width/2 - mc._width/2; mc._y = maxHeight/2 - mc._height/2; }); }