# Dynamic Pathnames, dot syntax

**URL:** https://forum.kirupa.com/t/dynamic-pathnames-dot-syntax/188805
**Category:** flash
**Created:** [May 10, 2006, 10:21pm UTC](https://forum.kirupa.com/t/dynamic-pathnames-dot-syntax/188805 "2006-05-10T22:21:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jnbeck](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jnbeck/32/1502_2.png) [@jnbeck](https://forum.kirupa.com/u/jnbeck)
#### Post date: [May 10, 2006, 10:21pm UTC](https://forum.kirupa.com/t/dynamic-pathnames-dot-syntax/188805/1 "2006-05-10T22:21:57Z")

</div>

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.

```auto
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";**
            }
        }
    }
}

```
