# Using XML for variable names

**URL:** <https://forum.kirupa.com/t/using-xml-for-variable-names/229692>\
**Category:** flash\
**Created:** [June 19, 2007, 3:31pm UTC](https://forum.kirupa.com/t/using-xml-for-variable-names/229692 "2007-06-19T15:31:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bardic](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/bardic/32/3708_2.png) [@bardic](https://forum.kirupa.com/u/bardic)\
**Post date:** [June 19, 2007, 3:31pm UTC](https://forum.kirupa.com/t/using-xml-for-variable-names/229692/1 "2007-06-19T15:31:47Z")

</div>

hey, I’m attempting to build a menu using a XML. I have read the tutorial on the site and I am attempt to do it in a slightly different manner.

Anyways, I am trying to make dynamic variable names for my text fields. And because of the way I am doing this I found it easier to try to use XML to hold the field name. But when I try to use the name from the XML file it won’t work. I can trace it and get the proper word but when used in the script it breaks.

Below I want to replace ‘popMenu’ with the fieldName variable.

```auto
    mainMenu.menu1.onRollOver = function(){    
        listLength = menu_xml.childNodes[0].childNodes;
        for(i=0;i<listLength.length;i++){            
            if(listLength*.nodeName == "m"){
                listLength = menu_xml.childNodes[0].childNodes*.childNodes;    
                tbH = 100;
                for(ii=0;ii<listLength.length;ii++){            
                    bCat = menu_xml.childNodes[0].childNodes*.childNodes[ii].attributes.n;
                    fieldName = menu_xml.childNodes[0].childNodes*.childNodes[ii].attributes.cn;
                    mainMenu.menu1.createTextField("popMenu",this.getNextHighestDepth(),0,tbH,80,50,50); 
                    mainMenu.menu1.popMenu.text = bCat;                
                    tbH+=15;
                    trace(ii);
                }
            }
        }
    }

```
