Hey everyone,
I am trying to get a handle on XML and as such I am going through Kirupas tut on displaying XML.
Unfortunately I cant even get past the first page without something going wrong.
I have saved my inventors.xml and the test page all in the same directory.
The inventors.xml looks like this:
<?xml version="1.0"?>
<inventors>
<person>
<name>Thomas Edison</name>
<comment>Inventor of many things such as the incandescent lightbulb.</comment>
</person>
<person>
<name>Doug Engelbart</name>
<comment>Invented the mouse at the Stanford Research Institute</comment>
</person>
</inventors>
The actionscript looks like this:
function loadXML(loaded) {
if (loaded) {
_root.inventor = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.comments = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
name_txt.text = _root.inventor;
comment_txt.text = _root.comments;
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("inventors.xml");
Everything is named perfectly but no matter what I try I keep getting undefined for the dynamic text:
What am I doing wrong?