I'm new to the xml/flash thing, though not new to programming in general. Anyway, I have a fairly simple xml file I'm working with, that looks like this:

Code:
<mapData>
<name>Louisiana</name>
<abbr>La</abbr>
<map>la.png</map>
  <community>
    <id>1</id>
    <title>Spring Woods</title>
    <city>New Orleans</city>
    <phone>555.5555</phone>
    <coords>
      <xCoord>11</xCoord>
      <yCoord>11</yCoord>
    </coords>
  </community>
  <community>
    <id>2</id>
    <title>Swamp Heights</title>
    <city>Baton Rouge</city>
    <phone>666.6666</phone>
    <coords>
      <xCoord>12</xCoord>
      <yCoord>12</yCoord>
    </coords>
  </community>
</mapData>
I'm simply trying to run through the xml recursively, but my recursive function magically craps out after going into the <name> node. I can't figure out for the life of me why it won't continue iterating through each sibling node and just goes in as deep as it can then craps out. Here's the function code:

Code:
function traceNodeNames(curr_node) {
	if(curr_node.hasChildNodes()) {
		trace("current Node name = " + curr_node.nodeName);
		children = curr_node.childNodes;
		trace ("Number of Children = " + children.length);
		for(i = 0; i < children.length; i++) {
			trace("total children = " + children.length + ", current child = " + i);
			x = traceNodeNames(children[i]);
			trace(x);
		}
		return i;
	}
	else {
		trace("value = " + curr_node.nodeValue);
		return 0;
	}
}
Anyone know why this isn't working? I've tried using the debugging tool as well, and when I step through it still just magically pops out of the recursion after getting into the <name> node. Any help with this would be great. Or if I'm totally wrong in assuming this sort of recursion would work in flash, what is a better way of pulling out data from an XML file so that I can use it to populate variables and mc's in a swf? Oh, I'm using MX2k4 btw.