# Dynamic dropdown menu

**URL:** <https://forum.kirupa.com/t/dynamic-dropdown-menu/182779>\
**Category:** flash\
**Created:** [March 21, 2006, 12:23pm UTC](https://forum.kirupa.com/t/dynamic-dropdown-menu/182779 "2006-03-21T12:23:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)\
**Post date:** [March 21, 2006, 12:23pm UTC](https://forum.kirupa.com/t/dynamic-dropdown-menu/182779/1 "2006-03-21T12:23:28Z")

</div>

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.

```auto

// 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??

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [March 21, 2006, 2:16pm UTC](https://forum.kirupa.com/t/dynamic-dropdown-menu/182779/2 "2006-03-21T14:16:20Z")

</div>

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

```

??

scotty(-:

---

<div class="post-metadata">

**Author:** ![beegcheef](https://avatars.discourse-cdn.com/v4/letter/b/9fc29f/32.png) [@beegcheef](https://forum.kirupa.com/u/beegcheef)\
**Post date:** [March 21, 2006, 3:22pm UTC](https://forum.kirupa.com/t/dynamic-dropdown-menu/182779/3 "2006-03-21T15:22:49Z")

</div>

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](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.

:} ]

---

<div class="post-metadata">

**Author:** ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)\
**Post date:** [March 22, 2006, 7:48am UTC](https://forum.kirupa.com/t/dynamic-dropdown-menu/182779/4 "2006-03-22T07:48:48Z")

</div>

@ 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.

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [March 22, 2006, 7:59am UTC](https://forum.kirupa.com/t/dynamic-dropdown-menu/182779/5 "2006-03-22T07:59:23Z")

</div>

If you still have problems, post your fla+xml 🙂

scotty(-:

---

<div class="post-metadata">

**Author:** ![Pascal\_S](https://avatars.discourse-cdn.com/v4/letter/p/f6c823/32.png) [@Pascal\_S](https://forum.kirupa.com/u/Pascal_S)\
**Post date:** [March 22, 2006, 8:20am UTC](https://forum.kirupa.com/t/dynamic-dropdown-menu/182779/6 "2006-03-22T08:20:35Z")

</div>

hehe its not an xml driven menu

ill pm you the fla file!
