Hi all,
I need some help.
I've setup a loop which runs and attaches buttons for a horizontal navigation, the button text is dynamic so the width of the button varies. I am checking the width of the text box and using this value to set the width of the button. This is all fine, the problem is with the positioning of the buttons. I don't want them to be equally spaced using something like xPos = i *50;
If button 01 is 50 wide and button 02 is 30 wide then button 02 would need to be positioned at 50 so it follows on from button 01. Then the 3rd button would be at 50+30 and so on. Hope this makes sense, it's a bit tricky to explain.
Here's my code
Any help much appreciatedPHP Code:for (i=0; i<clientInfo.length; i++) {
clientId = clientInfo[i][0];
clientName = clientInfo[i][1];
clientButtons = attachMovie("client_button", clientId, i+20);
clientButtons.clientTxt.text = clientName;
//Scale the button's width
clientButtons.clientTxt.autoSize = "left";
buttonXsize = clientButtons.clientTxt._width;
clientButtons.clientButtonHit._width = buttonXsize;
//Position the buttons
clientButtons._y = 150;
// this next bit is where i need help
clientButtons._x = 150*i;
}
}
Thanks




Reply With Quote