Hello,
I’m using the basic XML tutorial created by Kirupa. I want to use XML to load vocabulary words and definitions into Flash, and also display them online as an XML page. The problem is that when I add the bold or italics tags, these are treated as new nodes and mess up the function that calls the information. See the code I’m using below. I’ve looked around and cannot figure out how to fix this. Any help would be appreciated.
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.htmlText = _root.inventor;
comment_txt.text = _root.comments;
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("investors.xml");
pulling from this xml file
<?xml version="1.0"?>
<inventors>
<person>
<name>Thomas <b>Edison</b></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>