XML trouble

This what I got so far

[COLOR=Red]<eqid>
<id1>
<id>41</id>
<desc>TEST</desc>
<serial>123456</serial>
</id1>
</eqid>[/COLOR]

and the AS that I was trying to do is:

[COLOR=Blue]function loadXML(loaded) {

if (loaded) {

_root.eqid= this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.desc= this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.serial= this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
id.text = _root.eqid;
desc.text = _root.desc;
serial.text = _root.serial;
} else {
trace(“file not loaded!”);;

}

}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“structure.xml”);
[/COLOR]

the problem I think I have is the firstChild directions…please help, I did the tut on your site http://www.kirupa.com/developer/actionscript/xmldataflash.htm
and still dont understand the direction from tree to branch…you got in your AS inventor as root and comment as root, that doent make much sense to me. Isnt comment a node instead of a root ?

thanks in advance!

another question is, is it possiable to enable flash to write to a xml file?

  1. welcome to Kirupa! :pleased:
 and 
```php
 tags help make code more legible and thereby help people understand the code better thereby helping them better answer your question.
3) ... you really didn't have a question :huh: You just gave some code and said you think the problem is... ?  What exactly is the question again?
4) did you know that you are assigning equid, desc and serial all to the same value ( this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue; ) ?
5) also, I hope the desc and serial textfields are not in _root since you just defined variables in _root with the same name.  You'd then have no way to distinguish between the two.

:)

Ok, that made no sense!..or just maybe I’m so far in left feild…