|
-
dynamic text alignment - need help with code
Hi guys,
I've been following an xml tutorial webdesign tutorial, as I'm pretty new to the whole coding side of things, I've copied their code into my own design, which has been going fine up until this point.
In the tutorials the dynamic menus were alligned vertically, in my site I want them to run horizontally, well I managed to suss out how to realign them, the problem is that the spacing between each button is set according to the end of each (invisible) button.
This makes each gap a different size and makes the layout look really clunky.
I'm wondering if theres a line of code I can insert, which defines the size of each button according to the size of the text, or alternately, that starts the spacing from the end of the text rather than the button.
dont know if it helps, but here is the code I am currently using
function SS_createButtons() {
_root.btn_projects_main._visible = 0;
btn_xPos = _root.btn_projects_main._x;
btn_yPos = _root.btn_projects_main._y;
btn_xDistance = 100;
btn_yDistance = 50;
btn_numOfRows = 1;
btn_yMax = btn_yPos + ((btn_numOfRows - 1) * btn_yDistance);
for (count = 0; count < _root.projectCount; count++) {
duplicateMovieClip(_root.btn_projects_main, "btn_projects" + count, count);
_root["btn_projects" + count]._x = btn_xPos;
_root["btn_projects" + count]._y = btn_yPos;
_root["btn_projects" + count].text = namesArray[count];
if(btn_yPos == btn_yMax){
btn_xPos = btn_xPos + btn_xDistance;
btn_yPos = _root.btn_projects_main._y;
} else {
btn_yPos = btn_yPos + btn_yDistance;
}
}
SS_load_project(0);
tellTarget(_root.btn_projects0){
gotoAndPlay(3);
}
_root.curButton = "0";
}
any help/ideas would be massively appreciated
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|