# Storing XML data in array

**URL:** <https://forum.kirupa.com/t/storing-xml-data-in-array/157002>\
**Category:** flash\
**Created:** [July 29, 2005, 10:42am UTC](https://forum.kirupa.com/t/storing-xml-data-in-array/157002 "2005-07-29T10:42:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![or\_han](https://avatars.discourse-cdn.com/v4/letter/o/dec6dc/32.png) [@or\_han](https://forum.kirupa.com/u/or_han)\
**Post date:** [July 29, 2005, 10:42am UTC](https://forum.kirupa.com/t/storing-xml-data-in-array/157002/1 "2005-07-29T10:42:39Z")

</div>

This is just a simple problem that has annoyed me for hours. I want to get data from my XML file an store them in arrays but it doesnt!! Why??  
My script:

```auto

//XML function
function loadXML(loaded) {
	var headline_temp:Array = [];
	var text_temp:Array = [];
	if (loaded) {
		for (i=0; i<5; i++) {
		    headline_temp* = this.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
			text_temp* = this.firstChild.childNodes*.childNodes[1].firstChild.nodeValue;
		}
	} else {
		trace("file not loaded!");
	}
}
//////////////////////////////////////
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("extern/text.xml");

```

If I trace the arrays, it just returns ‘undefined’ but if I trace inside the function it returns the actual data. Why??
