# \[MX2004\] Levels problem in dynamic xml-menu \[Resolved\]

**URL:** <https://forum.kirupa.com/t/mx2004-levels-problem-in-dynamic-xml-menu-resolved/98516>\
**Category:** Uncategorized\
**Created:** [January 8, 2004, 1:11am UTC](https://forum.kirupa.com/t/mx2004-levels-problem-in-dynamic-xml-menu-resolved/98516 "2004-01-08T01:11:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScriptFlipper](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@ScriptFlipper](https://forum.kirupa.com/u/ScriptFlipper)\
**Post date:** [January 8, 2004, 1:11am UTC](https://forum.kirupa.com/t/mx2004-levels-problem-in-dynamic-xml-menu-resolved/98516/1 "2004-01-08T01:11:51Z")

</div>

I’m creating a dynamic menu with XML, and this is part of my code. I’ve written in the code what the problem is:

[AS]  
menuXml = new XML();  
menuXml.ignoreWhite = true;  
menuXml.onLoad = function(success) {  
if (success) {  
topMenuItem = this.firstChild.childNodes;  
xpos = 0;  
for (var i = 0; i\<topMenuItem.length; i++) {  
item = \_root.attachMovie(“topMenuItem”, “topMenuItem”+i, i);  
item.itemLabel.text = unescape(topMenuItem\*.attributes.itemLabel);  
item.itemUrl = topMenuItem\*.attributes.itemUrl;  
item.itemLabel.\_width = item.itemLabel.text.length_7;  
item.backlight.\_width = 4+item.itemLabel.\_width;  
item.\_x = 2+xpos;  
item.\_y = 2;  
xpos += item.backlight.\_width;  
if (topMenuItem_.childNodes.length) {  
subMenuItem = topMenuItem\*.childNodes;  
subMenu = item.attachMovie(“subMenu”, “subMenu”, 0);  
subMenu.\_visible = false;  
for (var iSub = 0; iSub\<subMenuItem.length; iSub++) {  
subItem = subMenu.attachMovie(“subMenuItem”, “subMenuItem”+iSub, iSub);  
subItem.itemLabel.text = unescape(subMenuItem[iSub].attributes.itemLabel)+" "+iSub;

```
				// some code here
				
			}
		}
		item.backlight.onRollOver = function() {
			this._alpha = 100;
		};
		item.backlight.onRollOut = function() {
			this._alpha = 0;
		};
		item.backlight.onRelease = function() {

```

////////////////// Here I wan’t as to see if there is a ////////////////  
////////////////// subMenu inside the current topMenu, ////////////////  
////////////////// and if so, to make it visible. ////////////////

```
			if (_parent.subMenu) { 
				_parent.subMenu._visible = true;
			}

```

///////////////////////////////////////////////////////////////////////

```
			getURL(this.itemUrl, "_blank");
		};
	}
}

```

};  
menuXml.load(“nav.xml”);  
[/AS]

so, how should i find the subMenu?  
shouldn’t it be in the \_parent layer, wich is the topMenu ?

Thank you in advance
