Here’s my script:
xmlTracks = new XML();
xmlTracks.load(“myXML.xml”);
xmlTracks.onLoad = tracksLoad;
function tracksLoad(success)
{
if(success)
{
for(var i = 0; i < this.childNodes.length; i++)
{
trace(this.childNodes*.nodeName);
}
trace(this.status);
}
else
{
trace(“error”);
}
}
Here’s the output:
tracks
null
0
and here’s the XML:
<tracks>
<song1 name=“one”/>
<song2 name=“two”/>
<song3 name=“three”/>
</tracks>
why does it print the null?
system
2
system
3
xmlTracks.load(“myXML.xml”);
xmlTracks.onLoad = tracksLoad;
function tracksLoad(success)
{
if(success)
{
this.ignoreWhite = true;
for(var i = 0; i < this.childNodes.length; i++)
{
trace(this.childNodes*.nodeName);
}
trace(this.status);
}
else
{
trace(“error”);
}
}
same thing…
system
4
… Set it before the XML file is loaded. :sigh:
xmlTracks = new XML();
xmlTracks.ignoreWhite = true;
xmlTracks.onLoad = tracksLoad;
xmlTracks.load("myXML.xml");
system
5
oops, thanks for the help.