# Xml array assignment problem

**URL:** <https://forum.kirupa.com/t/xml-array-assignment-problem/208358>\
**Category:** Uncategorized\
**Created:** [November 27, 2006, 10:07pm UTC](https://forum.kirupa.com/t/xml-array-assignment-problem/208358 "2006-11-27T22:07:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gjuddy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/gjuddy/32/2382_2.png) [@gjuddy](https://forum.kirupa.com/u/gjuddy)\
**Post date:** [November 27, 2006, 10:07pm UTC](https://forum.kirupa.com/t/xml-array-assignment-problem/208358/1 "2006-11-27T22:07:44Z")

</div>

Hi,

I’m trying to populate an array with info loaded in from an xml file. I’ve got the xml loading fine and I can trace everything but cannot seem to access the info outside of the function…here’s my code:

```auto
myXML.onLoad = function(success) {
	if (success) {
		populateNav(myXML);
	} else {
		trace("xml did not load");
	}
};
myXML.load("nowplaying.xml");

function populateNav(myXML) {
	var nowplayingXML = myXML.firstChild;
	var totalXML:Number = nowplayingXML.childNodes.length;
	var totalCases = totalXML;
	var spacing:Number = contentMC.itemsMC._width+10;
	var numberOfCases:Number = totalCases;
	var i:Number = -1;
	while (++i<numberOfCases) {
		var movie_title = nowplayingXML.childNodes*.childNodes[0].firstChild;
		var image_path = nowplayingXML.childNodes*.childNodes[1].firstChild;
		var link_to:Array = [nowplayingXML.childNodes*.childNodes[2].firstChild];
		trace(image_path);
	}
}

var imageholder:Array = [image_path];
trace(imageholder);

```

My trace inside of the populateNav function works great…all the info is there and image\_path returns all of my…image paths. So my XML is fine…what I can’t seem to do is pass that info outside of the populateNav function. My imageholder trace returns undefined. I think it’s got something to do with the fact that the imageholder trace is being performed before the xml is fully loaded…not sure what to do about that though…any help would be greatly appreciated.

Thanks,

Gjuddy
