Returning values out of XML.onLoad?

I’m trying to take an xml object, parse through it, turn the appropriate elements in object properties. Then, finally, pushing each object an array.

Then I need this array accessible outside of the XML.onLoad() function (since it returns nothing, I lose my array).

Here’s the code from my timeline:

#include “functions.as”
XML.prototype.ignoreWhite = true;

var top_nav:Array = new Array();
var my_xml:XML = new XML();
var xml_url:String = “nav/top_nav.xml”;

my_xml.load(xml_url);
my_xml.onLoad = transmitter;
function transmitter(success) {
if ( success == false ) {
return;
} else {
trace(“xml loaded”);
top_nav = createArrObj(this);
trace(top_nav.length);
// returns: 4 – correct, but trapped in the onLoad function
// note: the onLoad function returns nothing by definition
}
};

trace(top_nav.length); // returns: 0 <-- we’ve lost the array :frowning:

Does anyone know how I can get needed values out of the onLoad function? I can’t figure it out.

Thanks!
Sarah