Xml

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?

Set its [font=courier new]ignoreWhite[/font] property to [font=courier new]true[/font]. :stuck_out_tongue:

http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary840.html

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…

… Set it before the XML file is loaded. :sigh:

xmlTracks = new XML();
xmlTracks.ignoreWhite = true;
xmlTracks.onLoad = tracksLoad;
xmlTracks.load("myXML.xml");

oops, thanks for the help.

No problem. :stuck_out_tongue: