As 2 & xml-

Hey all. I’ve created what I thought was a simple way to load in some XML variables that I was going to then ‘hard-code’ variables for (so the site owners can change map links without editing the flash file) since I have a graphical map that can’t really be ‘dynamically’ built.

Anyway, so here’s the code, borrowed from an online tutorial but it simply won’t work. I’m not sure why it’s not working… I’ve traced everything and it seems to come down to the fact that the ‘thisxml’ variable that I’m using to get the childnode length keeps returning ‘0’.

XML File:(edited for size):


<xml version='1.0' encoding='utf-8'/>
<states>
<state name="Alabama" url="url.htm"/>
....
<state name="Wyoming" url="url.htm"/>
</states>

AS Code Frame 1:


stop();
myXML = new XML();
myXML.ignoreWhite=true;
myXML.load("states.xml");
myXML.onLoad = function(success) {
thisXML = myXML.firstChild.childNodes.length; 
trace ("thisXML:"+thisXML);
amount = []; 
for (var i=0; i<thisXML ; i++) {
amount* = myXML.firstChild.childNodes*.attributes.name;
}
gotoAndStop(2);
}

AS Code Frame 2:


stop();
for (var i=0; i<thisXML ; i++) {
    trace ("just testing the loop.");
// Will place code here to create a variable based on the node name (ie 'Arkansas') and assign it's value as the url atrribute)
}

It doesn’t seem to get anymore straight-forward than this (lol) but I know I’ve been out of the flash game for awhile now…

Both the ‘thisXML’ and ‘amount’ variables are at ‘0’.

Any ideas?