I have an XML node: <link>http://www.google.com</link>
which if that node exists will be applied to a button using the following code:
siteBtn.onRelease = function() {
getURL(link, "_blank");
};
However when i click the button it gives me an undefined address - and does not work…???
Full Code:
function loadXMLData(loaded) {
if (loaded) {
xmlNode = this.firstChild;
brandname = xmlNode.childNodes[0].childNodes[0].firstChild.nodeValue;
description = xmlNode.childNodes[0].childNodes[1].firstChild.nodeValue;
link = xmlNode.childNodes[0].childNodes[2].firstChild.nodeValue;
brandNameTxt.htmlText = brandname;
brandTxt.htmlText = description;
brandTxt._width = 325;
} else {
brandTxt.htmlText = "Sorry, the text was unable to load.";
trace("Could not load XML file");
}
}
xmlFile = new XML();
xmlFile.ignoreWhite = true;
xmlFile.onLoad = loadXMLData;
xmlFile.load("brands/brand1/brand1.xml");
onEnterFrame = function () {
if (xmlNode.childNodes[0].childNodes[2].firstChild) {
link = xmlNode.childNodes[p].childNodes[2].firstChild;
siteBtn._visible = true;
siteBtn.onRelease = function() {
getURL(link, "_blank");
};
} else {
siteBtn._visible = false;
}
};