I want only the background of my movie to be fullscreen and scaleable; the content should stay the same size.
I have tried a couple of scripts like this one:
function initialize()
{
startingSizeX = Stage.width; // get these values before setting noScale
startingSizeY = Stage.height;
Stage.scaleMode = “noScale”; // prevent menus from resizing
backdrop._width = Stage.width;
backdrop._height = Stage.height;
menu1originalX = 20; // save original pos
menu1originalY = 50; // "
menu2originalX = 477; // "
menu2originalY = 50; // "
positionMenus(); // adjust menu position
// watch for resizing. When it occurs, resize the background picture to match the stage size.
// All the other objects remain the same size but we reposition the objects by the amount needed.
listener = new Object();
listener.onResize = function ()
{
// keep the background picture the same size as the stage
backdrop._width = Stage.width;
backdrop._height = Stage.height;
positionMenus(); // reposition the menus as needed
};
Stage.addListener(listener);
}
function positionMenus()
{
// how much difference is stage size now compared to the original size?
var diffSizeX = startingSizeX - Stage.width;
var diffSizeY = startingSizeY - Stage.height;
// add half the difference to the menu position
menu1._x = menu1originalX + (diffSizeX / 2);
menu1._y = menu1originalY + (diffSizeY / 2);
menu2._x = menu2originalX - (diffSizeX / 2);
menu2._y = menu2originalY + (diffSizeY / 2);
}
None worked. Isn’t there a more simple Actionscript?
I’d appreciate any help.
Thanks in advance
Lars
No. I want the background scaled, when you change the window size of your browser. It does not matter when the background does not keep its proportions.
Stage.scaleMode ="noScale"; // no scaling
Stage.align = "TL"; //top-left alignment
var oStageListener:Object = new Object();
Stage.addListener(oStageListener);
oStageListener.onResize = function():Void
{
mcBackground._x = 0;
mcBackground._y = 0;
mcBackground._width = Stage.width;
mcBackground._height = Stage.height;
/*-------*/
/* aligning the content movieclip that should be named as mcContentHolder. Just in case you might be using pixelfonts, we're rounding the _x and _y values. */
mcContentHolder._x = Math.round(Stage.width/2+mcContentHolder._width/2);
mcContentHolder._y = Math.round(Stage.height/2+mcContentHolder._height/2);
}