# Problem referencing xml values in actionscript

**URL:** <https://forum.kirupa.com/t/problem-referencing-xml-values-in-actionscript/229030>\
**Category:** flash\
**Created:** [June 13, 2007, 2:49pm UTC](https://forum.kirupa.com/t/problem-referencing-xml-values-in-actionscript/229030 "2007-06-13T14:49:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sean1983uk](https://avatars.discourse-cdn.com/v4/letter/s/ccd318/32.png) [@sean1983uk](https://forum.kirupa.com/u/sean1983uk)\
**Post date:** [June 13, 2007, 2:49pm UTC](https://forum.kirupa.com/t/problem-referencing-xml-values-in-actionscript/229030/1 "2007-06-13T14:49:45Z")

</div>

I’m going round in circles with this…

I can get it to display a chosen club name by setting the variable var1, but I need it so users can click different movieclips to select which club they want (ie change the value of var1)

Also I realise as it is at the moment this will not be possible as its only calling displayContent when it initially loads up.

Any help or pointers?

```auto

///////////// Get XML Info /////////////
function loadXML(loaded) {
    if (loaded) {
        _root.xmlNode = findNode(this, "teams");z
        
        for (i=0; i<_root.xmlNode.childNodes.length; i++) {
            _root.FixNode = findNode(_root.xmlNode.childNodes*, "team");
            _root.clubID = _root.FixNode.attributes.id;
            _root.clubName = _root.FixNode.attributes.name;
            _root.clubAdd1 = _root.FixNode.attributes.address1;
            _root.clubAdd2 = _root.FixNode.attributes.address2;
            _root.clubAdd3 = _root.FixNode.attributes.address3;
            _root.clubAdd4 = _root.FixNode.attributes.address4;
            _root.pageLink = _root.FixNode.attributes.pageurl;
            
            displayContent();
        }
    }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("clubs.xml");

///////////// FindNode /////////////
function findNode(node, nodeName) {
    if (node.nodeName == nodeName) {
        return node;
    }
    for (var i = 0; node.childNodes && i<node.childNodes.length; i++) {
        var foundNode = findNode(node.childNodes*, nodeName);
        if (foundNode != null) {
            return foundNode;
        }
    }
    return null;
}

var1 = 139;
function displayContent() {
    if (loaded == filesize) {
            if(clubID == var1){
        testText.text = _root.clubName;
}
    }
}

```
