# As 2 & xml-

**URL:** <https://forum.kirupa.com/t/as-2-xml/290132>\
**Category:** flash\
**Created:** [June 10, 2009, 6:44am UTC](https://forum.kirupa.com/t/as-2-xml/290132 "2009-06-10T06:44:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![desoto0311](https://avatars.discourse-cdn.com/v4/letter/d/22d042/32.png) [@desoto0311](https://forum.kirupa.com/u/desoto0311)\
**Post date:** [June 10, 2009, 6:44am UTC](https://forum.kirupa.com/t/as-2-xml/290132/1 "2009-06-10T06:44:31Z")

</div>

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):

```auto

<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:

```auto

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:

```auto

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?
