I’m using Flash 8, and creating a dynamic XML driven menu.
I can’t for the life of me figure out the syntax to make a 2 dimensional path to a movieclip.
I can reference a movieclip dynamically with: _root[“main”+i].label.text
but how can I reference a movieclip like this:
_root.main1.subBut1_1.label.text
Where “main1” AND “subBut1_1” are dynamically written.
I’ve tried root[“main”+i][“subBut”+i+""+t] and root[“main”+i].[“subBut”+i+""+t], no dice. I would think it was pretty common to try and do something like this.
function loadXML(loaded) {
if (loaded) {
xmlNode_xml = this.firstChild;
butNode_xml = xmlNode_xml.firstChild;
prefNode_xml = butNode_xml.nextSibling;
mainBG = prefNode_xml.firstChild.attributes["mainBG"];
tempClr = new Color(mainBGclr);
tempClr.setRGB(mainBG);
mainBGclr._alpha = 100;
numMain = butNode_xml.childNodes.length;
for(i=0; i<numMain; i++){
numSubs = butNode_xml.childNodes*.childNodes.length;
yCount = i*25;
_root.attachMovie("mainBut","main"+i,i,{_x:0, _y:yCount});
_root["main"+i].label.text = butNode_xml.childNodes*.attributes["label"];
for(t=0; t<numSubs; t++){
ySub = (t*25)+25;
_root["main"+i].attachMovie("subBut","sub"+i+"_"+t, this.getNextHighestDepth(),{_x:0, _y:ySub});
**_root["main"+i]["subBut"+i+"_"+t].label.text = "Test";**
}
}
}
}