;

PDA

Click to See Complete Forum and Search --> : How to get the real width of a button?


SaltamonteZ
05-29-2007, 05:56 AM
Example:

var resetButton:Button = new Button();
resetButton.label = "Blabera Blub!";
resetButton.move
(
stage.width/2-resetButton.width/2,
stage.height/2-resetButton.height/2
);
addChild(resetButton);


Button always ends up slightly to the left.

cancerinform
05-29-2007, 06:15 AM
If you want the actual width and height of the movie you need to write this:
stage.stageWidth/2+resetButton.width/2,
stage.stageHeight/2+resetButton.height/2

if you actually want to center your button then this is correct:
stage.stageWidth/2-resetButton.width/2,
stage.stageHeight/2-resetButton.height/2

SaltamonteZ
05-29-2007, 06:18 AM
Solved already. Code was ok, the way I nested it was not...