# Help with dynamic menu

**URL:** https://forum.kirupa.com/t/help-with-dynamic-menu/205607
**Category:** Uncategorized
**Created:** [October 31, 2006, 4:46am UTC](https://forum.kirupa.com/t/help-with-dynamic-menu/205607 "2006-10-31T04:46:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mattzi](https://avatars.discourse-cdn.com/v4/letter/m/45deac/32.png) [@mattzi](https://forum.kirupa.com/u/mattzi)
#### Post date: [October 31, 2006, 4:46am UTC](https://forum.kirupa.com/t/help-with-dynamic-menu/205607/1 "2006-10-31T04:46:25Z")

</div>

Hello. I have a little problem. Currently I have a vertical menu which is generated via xml. Each menu item also has its own sub menu (not shown). When clicking on the top level item i want the rest of the items to move down to show the sub navigation. ie

menu item 1  
menu item 2  
menu item 3  
menu item 4

* * *

menu item 1  
sub menu 1  
sub menu 2  
sub menu 3  
menu item 2  
menu item 3  
menu item 4

I have that working fine, but i havnt a clue how to fix it. Say if i have clicked on **menu item 1** , and the sub menu is displaying, before i have can view another sub menu i have to click on **menu item 1** to close it before I can click on **menu item 2**.

this is the code that im using to tell weather or not to move the buttons up or down:

```auto

menuButton.clicked = false;
menuButton.onRelease = function () { 
    if(menuButton.clicked == false) {
        _root.moveMovieDown(buttonNum, buttonHeights);
        menuButton.clicked = true;
    } else {
        _root.moveMovieUp(buttonNum); 
        menuButton.clicked = false; 
    }
}

```

Basicly i want to be able to click on any menu item button, if a menu item is open, i want it to close, and then open the new one. just like this one. [http://www.bridgehead.com.au/case.php](http://www.bridgehead.com.au/case.php)

hope it makes sense 🙂
