ok - i have a menu that is created from an xml file. all seems to be working well with that. i want the instance of the menuElement_mc to change when the user clicks on one of them - ok that works. BUT when a user clicks on another instance of the menuElement_mc i want that instance to change to the ON state and any other previously click item to go to the OFF state.
here is the code that loads the xml:
[AS]function assembleMenu() {
for (var i = 0; i<myarray.length; i++) {
duplicateMovieClip(menuElement_mc, “menuElement_mc”+i, i);
thistimeline[“menuElement_mc”+i]._y = menuElement_mc._y+(offseti);
//offset
thistimeline[“menuElement_mc”+i].header = myarray.header;
thistimeline[“menuElement_mc”+i].link = myarray*.link;
}
menuElement_mc.unloadMovie();
//
contentheight = this._height;
//
if (contentheight>containerheight) {
_parent.scrollbar1_mc._visible = true;
_parent.scrollbar1_mc.sliderHeight();
} else {
_parent.scrollbar1_mc._visible = false;
}
//
//
}
function menuItem(h, l) {
this.header = h;
this.link = l;
}
//
//
var myarray = new Array();
var myXml = new XML();
myXml.onLoad = function() {
var head, link;
for (var i = 0; i<this.firstChild.childNodes.length; i++) {
if (this.firstChild.childNodes*.nodeName != null) {
head = this.firstChild.childNodes*.childNodes[1].firstChild.nodeValue;
link = this.firstChild.childNodes*.childNodes[3].firstChild.nodeValue;
myarray.push(new menuItem(head, link));
}
}
assembleMenu();
};
myXml.load(_parent._parent.XMLFileToLoad);[/AS]
here is the code for the menuElement:
[AS]header_txt.text = header;
//
hotspot_btn.onRelease = function() {
_root.results_mc._x = Math.round(_root.menu_mc._x+325);
_root.results_mc._y = Math.round(_root.menu_mc._y);
//
// frame 2 has the ON state for the button
gotoAndStop(2);
//
_root.results_mc.loadMovie(_parent._parent._parent.NameofResultsPanel);
//
// link is the name of the XML file to populate the results panel
_root.link = link;
};
stop();[/AS]