# Looking for help modifying an xml menu AS2

**URL:** <https://forum.kirupa.com/t/looking-for-help-modifying-an-xml-menu-as2/284230>\
**Category:** flash\
**Created:** [March 16, 2009, 11:00pm UTC](https://forum.kirupa.com/t/looking-for-help-modifying-an-xml-menu-as2/284230 "2009-03-16T23:00:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anchorball](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anchorball](https://forum.kirupa.com/u/anchorball)\
**Post date:** [March 16, 2009, 11:00pm UTC](https://forum.kirupa.com/t/looking-for-help-modifying-an-xml-menu-as2/284230/1 "2009-03-16T23:00:28Z")

</div>

I am looking for help modifying an xml menu.  
The menu was horizontal, but changing it to vertical.  
Have it vertical, but can’t get the on state indicator to update to a new \_y position based on the text postion in the menu. (menu\_line\_mc)

Here’s the code, any help would be appreciated:

//Create Menu Items  
function createMenu() {  
menu\_item\_mc.\_visible = false;//Set invisible first menu item  
var xcoor = 0;//Menu item X coordinate  
var ycoor = 0;//Menu item Y coordinate  
var widths = 0;//Menu item width  
var heights = 0;//Menu item height  
for (i=0; i\<\_root.menuItems.length; i++) {  
//Item  
var menu\_item\_mcx = “menu\_item\_mc”+i;  
duplicateMovieClip(menu\_item\_mc, menu\_item\_mcx, (i+10000));  
with (this[menu\_item\_mcx]) {  
with (menu\_item\_name\_mc) {  
name\_txt.autoSize = true;  
name\_txt.text = \_root.menuItems\*.name;  
widths = Math.floor(name\_txt.\_width);  
heights = Math.floor(name\_txt.\_height);  
}  
with (menu\_item\_holder\_mc) {  
\_width = widths;  
\_height = heights;  
}  
}  
this[menu\_item\_mcx].i = i;  
this[menu\_item\_mcx].heights = heights;  
this[menu\_item\_mcx].widths = widths;  
setProperty(menu\_item\_mcx, \_x, xcoor);  
setProperty(menu\_item\_mcx, \_y, ycoor);  
setProperty(menu\_item\_mcx, \_visible, true);  
//Line  
if (i == \_root.currentMenuItem) {  
//Import transition effects of flash  
import mx.transitions.Tween;  
import mx.transitions.easing;  
//Change line color  
var color:Color = new Color(menu\_line\_mc);  
color.setRGB(\_root.menuItems\*.lineColor);  
//Tween Y coordinate of bottom line  
new Tween(menu\_line\_mc, “\_y”, Regular.easeOut, menu\_line\_mc.\_y, ycoor, 0.2, true);  
new Tween(menuItems\*, “\_y”, Regular.easeOut, menu\_line\_mc.\_y, ycoor, 0.2, true);  
//Change line width  
menu\_line\_mc.\_height = 20;  
menu\_line\_mc.\_width = widths+20;

```
	}
	xcoor += 0;
	ycoor += heights+20;
}

```

}  
createMenu();  
stop();
