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?
///////////// 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;
}
}
}