Dynamic dropdown menu

i have a dynamic drop down menu in which you can easily add menu items via an array.
Some menu items are longer then others and they have to be 2 lines instead of 1 but i don’t know how to position them.



// submenu buttons
    for(var j=0; j<Menus*.length; j++)
    {
        // create the button
        m.attachMovie("SubMenu", "Btn" + j, 5+j);
        
        // shortcut reference
        var b = m["Btn"+j];

//this is where you set up to place the submenu's from eachother and the position from the main menu button.

b._y = (j*20)+ this._y +20;
b._x = this._x;

how can i make this so dynamic so that if people add longer menu items they still position nice under eachother??

for (var j = 0; j<Menus*.length; j++) {
	var b = m.attachMovie("SubMenu", "Btn"+j, 5+j);
	b._y = 20+(j*20);
}

??

scotty(-:

Hi, you may want to try and check out this source:
http://www.flashkit.com/movies/Scripting/Using_External_Files/Linkwrit-WD_Zitma-7759/index.php

he uses a drop down component that resizes and fits the new labels well.

:} ]

@ scotty That doesnt work. It doesnt read the items in the array anymore it says undefined.

@beegcheef I am sorry that is not what i am looking for.

Scotty i will try to change the script to just the dynamic menu what reads from an array and i will try the code again.

If you still have problems, post your fla+xml :slight_smile:

scotty(-:

hehe its not an xml driven menu

ill pm you the fla file!