# \[as3\] arrange menu dynamically

**URL:** <https://forum.kirupa.com/t/as3-arrange-menu-dynamically/295469>\
**Category:** flash\
**Created:** [August 31, 2009, 2:59am UTC](https://forum.kirupa.com/t/as3-arrange-menu-dynamically/295469 "2009-08-31T02:59:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lolomedia](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@lolomedia](https://forum.kirupa.com/u/lolomedia)\
**Post date:** [August 31, 2009, 2:59am UTC](https://forum.kirupa.com/t/as3-arrange-menu-dynamically/295469/1 "2009-08-31T02:59:22Z")

</div>

Good evening Kirupa friends:

Im creating a menu of 10 items and I want to arrange their x and y positions without writing too many lines of code… so this is what i got so far.

```auto

//these are my menu items that are reference by their ids
menuItems = new Array(menu1, menu2, menu3, menu4, menu5, menu6, menu7, menu8, menu9, menu10);

//this is the function that position the menu items the first time the app launches
private function arrange():void
            {
                var intY:int = 117;
                var intX:int = 35;
                
                var i:int = 0;
                var menuLength:int = menuItems.length;
                for (i; i < menuLength; i++)
                {
                    menuItems*.y = intY;
                    menuItems*.x = intX;
                    intY += 49;
                }
            }

```

all of that above is good…  
so what i want to do now is lets say i select menu item 2… if that’s the case, i want to move the other items down x amount of pixels by its y position…and keep menu item 1 in its default place… i hope this makes sense… is there a short way to do this to avoid repetitive coding?

thanks!
