dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: dynamic navigation positioning

  1. #1
    Junior Member
    Join Date
    Nov 2003
    Posts
    17

    dynamic navigation positioning

    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
    PHP Code:
    for (i=0i<clientInfo.lengthi++) {         
    clientId clientInfo[i][0];         
    clientName clientInfo[i][1];         
    clientButtons attachMovie("client_button"clientIdi+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;     


    Any help much appreciated
    Thanks

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    clientButtons._x + clientButtons.clientButtonHit._width + 20; // or any number in pixels.

    assuming the registration is 0,0 so _x is on the left of the button. If not, divide the _width by 2.

    gparis

  3. #3
    Junior Member
    Join Date
    Nov 2003
    Posts
    17
    Thanks for the reply gparis, I'm not sure if I explained myself properly.

    Here's what i want to do:

    [button1][___button2___][________button3_________][_button4_]

    Button one is the exception, for the positioning of all the following buttons I need to get the width of the previous button.

    Thanks for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center