Get data from Xml problem

Hi all!

I have this problem:

I have this xml file

<audio id="1" media="cd">
  <title>Example 1</title>
  <location>A1</location>
  <songs>
   <song num="1" name="example1" file="" />
   <song num="2" name="example2" file="" />
  </songs>
 </audio>

And i want to get all the songs from the songs element with this function:

function processXMLData(success) {
    if (success) {
        var list = this.firstChild.childNodes[2].childNodes;
        for (var i = 0; i<list.length; i++) {
            songs = list*.attributes.name;
            trace(songs);
        }
    } else {
        songs = "no audio file found!";
    }
}
var xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = processXMLData;
xmlData.load("xmlsmall.xml");
stop();

I create a dymanic text field with the variable songs but when i test it it displays only the last song…

Any ideas?:sigh:


var xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = function (success) {
    if (success) {
        var list = this.firstChild.childNodes[2].childNodes;
        for (var i = 0; i<list.length; i++) {
            _root.myTextBox.text [U]**+=**[/U] list*.attributes.name + "
";
        }
    } else {
        _root.myTextBox.text  = "no audio file found!";
    }
};
xmlData.load("xmlsmall.xml");
stop();

Thanks a lot! :slight_smile: I knew it wasnt so difficult but i couldnt imagine the way… :smirk: