[Flash 8]XML variable will trace, but will not work in script?

Hey all,

I made a button that when you click, it starts to play a sound. The sound is loaded through an XML file. The XML file only has one node which is the path of the sound I want played.

So I loaded the XML file and made a variable for my sound node and traced it to make sure it worked, and it did. Then later on when I use that variable to make the sound load, it says that there is an error opening url and that the path ends with ‘undefined’. Here’s the whole script:

**load sound:

**stop();
var myXML:XML = new XML();
myXML.ignoreWhite = true;
myXML.onLoad = function(success){
if(success) {
for (var x=0;x<this.firstChild.childNodes.length;x++) {
var soundNode:XMLNode = this.firstChild.childNodes[x];
trace(soundNode);
}
}else{
//error statement here
}
}
myXML.load(“C:/Documents and Settings/TomNez/Desktop/sound/audio.xml”);


**And then play sound:
**
var mySound:Sound = new Sound();

mySound.loadSound(soundNode[x], true);
mySound.onSoundComplete = function() {
this.start();
};


The trace statement gives me the right information when I test it. And, if I replace “soundNode[x]” with the actual sound name, it works properly. Does anyone know why it won’t let me use the soundNode variable in my loadSound? Any help would be greatly appreciated.

-Tom