[AS2 - CS3] XML to Array processing help!

I’ve got a function that loads an XML file, and processes it into an array. Outside the function, if I trace for any of the contents of the array, it comes back undefined. What I’ve noticed is that the trace command is triggered before the array has been populated, even though the function to populate the array is called prior to the trace command.

How do I fix that?! This is counterintuitive to me!

Here’s the code:


var playListArray = new Array();

var myXML:XML = new XML();
myXML.ignoreWhite=true;
myXML.load("videoList.xml");
myXML.onLoad = function(success) {
	if (success) {
		var myVideo = myXML.firstChild.firstChild.childNodes;
		for (i=0; i<myVideo.length; i++) {
			var clipTitle = myVideo*.attributes.label;
			var swfFile = myVideo*.attributes.url;
			
			playListArray* = [i,swfFile,clipTitle];
                        trace(playListArray);   //this trace is triggered AFTER the trace below!
		}
	}
}

trace(playListArray);    //this trace returns an empty result...?!?!?!?