Hey guys I’m really struggling with this. I’m trying to display my XML data through two dynamic text boxes that I have on my stage but keeps showing up with “undefined”. The FLA and XML files are located in the same folder. I followed the tutorial on here and customised it to match my node names and text box instance names but and left the code the same but nothing
Actionscript Code:
function loadXMLData(loaded) {
if (loaded) {
_root.news = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.comment = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
news_txt.text = _root.news;
comment_txt.text = _root.comment;
}
else {
trace(“Could not load XML file”);
}
}
xmlFile = new XML();
xmlFile.ignoreWhite = true;
xmlFile.onLoad = loadXMLData;
xmlFile.load(“news.xml”);
XML Code:
<?xml version=“1.0”?>
<news>
<info>
<latest>What's the latest?</latest>
<comment>You can find us at the markets.</comment>
</info>
</news>
Would really like to know what I’m doing wrong so any help would be appreciated. Thanks.