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:

    <title>Spring Woods</title>
    <city>New Orleans</city>
    <title>Swamp Heights</title>
    <city>Baton Rouge</city>
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:

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]);
		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.