# Really stuck with dynamic menu?

**URL:** <https://forum.kirupa.com/t/really-stuck-with-dynamic-menu/25901>\
**Category:** Uncategorized\
**Created:** [July 17, 2003, 1:18pm UTC](https://forum.kirupa.com/t/really-stuck-with-dynamic-menu/25901 "2003-07-17T13:18:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![keitai](https://avatars.discourse-cdn.com/v4/letter/k/73ab20/32.png) [@keitai](https://forum.kirupa.com/u/keitai)\
**Post date:** [July 17, 2003, 1:18pm UTC](https://forum.kirupa.com/t/really-stuck-with-dynamic-menu/25901/1 "2003-07-17T13:18:19Z")

</div>

Hi there,

I am really stuck here. this what i want to do:  
1: Create a menu from xml  
2 with a subMenu.  
3 and that subMenu slides in.

To accomplish this i used [http://www.kirupa.com/developer/flash5/slidingmenu.htm](http://www.kirupa.com/developer/flash5/slidingmenu.htm)  
for the movement.

Now in AS i have

```php

makeMenu = function (success) {
	// linkage name of button movieclip
	myItem = "menu_btn";
	// initialize x and y pos
	myX = -50;
	myY = 50;
	for (i = 0; i < myXML.firstChild.childNodes.length; i++) {
		//trace (myXML.firstChild.childNodes.length);
		title = (myXML.firstChild.childNodes*.attributes.NAME);
		//trace (title);
		this.attachMovie (myItem, "title" + i, i + 5);
		// attach item button graphic for each menu heading
		thisItem = this["title" + i];
		thisItem.menuLabel = (title);
		// label the button with id attribute of XML node
		thisItem._x = myX += (thisItem._width);
		// reposition item on Y axis
		thisItem._y = myY;
		k= i;
		trace("k has a value of = " +k);
		// to move the submenu calculate X-target pos
		thisItem.onPress = function () {
			if (k < 4) {
				trgt = 8 - (k * 2);
				_root.xnew = _root.mask2._x + (trgt * (500 / 2));
				trace ("xtarget= " + _root.xnew);
			} else {
				trgt = 8 - ((k * 2) + 2);
				_root.xnew = _root.mask2._x + (trgt * (500 / 2));
				trace ("xTarget= " +_root.xnew);
			}
					};
	}
};

```

I want to use the thisItem.onPress to set the xnew

any suggestions.
