Hi.
This is doing my head in.
I have a movieclip “myBacking_mc” that expands to fit the browser window. However, it’ll only expand to fit if I manually adjust the size of the browser: maximise it, or just adjust it’s size by one pixel.
Obviously that’s rubbish.
How do I make the movieclip “myBacking_mc” expand to fit the size of the browser window automatically when the page loads?
My Actionscript is below. Not very tidy I suspect as I’m pretty much making it up as I go along, but it does the job apart from this one last thing.
Thanks everyone.
stop();
Stage.scaleMode = "noscale";
Stage.align = "tl";
Stage.addListener({onResize:reposition});
function reposition() {
var header = _root.myHeader_mc;
var content = _root.myContent_mc;
var footer = _root.myFooter_mc;
var nPos;
nPos = getNewPosition(header);
header._x = nPos.x;
header._y = 0;
nPos = getNewPosition(content);
content._x = nPos.x;
content._y = nPos.y;
nPos = getNewPosition(footer);
footer._x = nPos.x;
footer._y = Stage.height-footer._height;
}
function getNewPosition(mc) {
var newX = Math.floor((Stage.width-mc._width)/2);
var newY = Math.floor((Stage.height-mc._height)/2);
return {x:newX, y:newY};
}
reposition();
stageListener = new Object();
stageListener.onResize = function() {
expandBacking();
};
Stage.addListener(stageListener);
expandBacking = function () {
myBacking_mc._width = Stage.width;
myBacking_mc._height = Stage.height;
};