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.length7;
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