Hi, I’m trying to load information from an XML file into a textbox in Flash. Some of the information is just made up for this testing. So, the following code is placed into the first (and only) frame on the timeline along with a dynamic textbox with the variable name “textBox”…
textBox = "";
titlesArray = new Array();
function pushArray() {
trace (objXML.firstChild.childNodes.length);
for (var count = 1; count < objXML.firstChild.childNodes.length; count++) {
nodeObj = objXML.firstChild.childNodes[count];
titlesArray[count] = nodeObj.attributes.title;
trace(titlesArray[count]);
textBox = titlesArray[count];
}
}
// load XML doc
objXML = new XML();
objXML.onLoad = loadXML;
objXML.load("xmldocument.xml");
// onLoad XML function
function loadXML(success) {
if (success) {
_root.pushArray();
} else {
}
}
And the XML below is stored in the filename “xmldocument.xml”…
<WEBSITES>
<WEBSITE title="XMLStuff"/>
<WEBSITE title="DavidFox"/>
<WEBSITE title="Thirdone"/>
</WEBSITES>
It looks like Flash is returning the wrong amount of nodes in the XML document so I really don’t know what I’m doing wrong.
Any help would be greatly appreciated.