Fullscreen / fullbrowser background resize function in Actionscript 3.0
function resizeBackground():void {
FrontpageFullscreener.scaleX = stage.stageWidth/ImageWidth;
FrontpageFullscreener.scaleY = FrontpageFullscreener.scaleX;
if (stage.stageHeight > (ImageHeight * (stage.stageWidth/ImageWidth))) {
FrontpageFullscreener.scaleY = stage.stageHeight/ImageHeight;
FrontpageFullscreener.scaleX = FrontpageFullscreener.scaleY;
}
}
I was being lazy and my google-fu failed to bring this up and it’s ever so frickin trendy. (You bandwidth whores.) So this is how you do it. Requires you to supply the info for ImageWidth and ImageHeight (because the files are fat FrontpageFullscreener.x might not work for you if the image ain’t loaded) and set all your own resize listeners/stage scaling. Setting mybitmap.smoothing = true will keep things smooth.
(Try Dr Nic’s syntax highlighter.)