# Returning values out of XML.onLoad?

**URL:** <https://forum.kirupa.com/t/returning-values-out-of-xml-onload/137053>\
**Category:** Uncategorized\
**Created:** [February 10, 2005, 10:09pm UTC](https://forum.kirupa.com/t/returning-values-out-of-xml-onload/137053 "2005-02-10T22:09:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![codergirl](https://avatars.discourse-cdn.com/v4/letter/c/ee59a6/32.png) [@codergirl](https://forum.kirupa.com/u/codergirl)\
**Post date:** [February 10, 2005, 10:09pm UTC](https://forum.kirupa.com/t/returning-values-out-of-xml-onload/137053/1 "2005-02-10T22:09:04Z")

</div>

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 ☹

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

Thanks!  
Sarah
