PDA

View Full Version : Positioning Buttons Always At The Bottom Of Stage



tomyknoker
04-01-2007, 10:26 AM
I have a group of 6 buttons which on my stage sit in the center and are 20 pixels from the bottom, I am trying to create a bit of a liquid layout, and the browser is going to be able to resized by the user. I want always for the buttons to stay at the bottom in the center of the browser 20 pixels from the bottom no matter wether it is resized too... any ideas?

BLiZZaRD
04-13-2007, 03:41 PM
Use math to get width and height. Make proportional to stage (would go into more detail but I have seen your codes and you have done this before :))

Place on the stage with AS instead of manual placement, and set the _.x and _.y to be the same proportions as well, where they will sit 20 pixels from the bottom.

(don't forget to "export for actionscript ;) )

jamiller
04-20-2007, 11:01 PM
First I would create a "menu" mc (make sure to give it an instance name of menu) with the 6 buttons inside. Make sure you align all the buttons above the y-axis (y will be a negative number) and in the middle of the x-axis otherwise the values below wouldn't quite work.

Stage.scaleMode = "noScale";
Stage.align = "tl";

stageListener = new Object();

function setMenu() {
menu._y = Stage.height-20;
menu._x = Stage.width/2;
}
stageListener.onResize = function () {
setMenu();
}
Stage.addListener(stageListener);

setMenu();