# Can't display any data in array while parsing XML file

**URL:** <https://forum.kirupa.com/t/cant-display-any-data-in-array-while-parsing-xml-file/250225>\
**Category:** flash\
**Created:** [January 27, 2008, 8:00am UTC](https://forum.kirupa.com/t/cant-display-any-data-in-array-while-parsing-xml-file/250225 "2008-01-27T08:00:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qpixo](https://avatars.discourse-cdn.com/v4/letter/q/c4cdca/32.png) [@qpixo](https://forum.kirupa.com/u/qpixo)\
**Post date:** [January 27, 2008, 8:00am UTC](https://forum.kirupa.com/t/cant-display-any-data-in-array-while-parsing-xml-file/250225/1 "2008-01-27T08:00:17Z")

</div>

I try to parse a xml file into an array. For some reason I don’t understand WHY I can’t see any datas in my array (tab\_test) when I traced it from outside of the function.  
Btw, my tab\_test is a global variable.

It doesn’t make sense. It’s that something to do with flash cs3 garbage collector?? It deletes it??  
(I tried to understand WHY that could happen…)

It gives me an error message saying there’s no contains in the array null object something…  
Obsviously, my tab\_test.lenght = 0

public var tab\_test:Array = new Array();

// call it in constructor  
\_initXMLFile();

for(var i:uint=0;i\<this.tab\_test.length;i++) {  
trace('TabTest: '+this.tab\_test\*.file);  
}

private function \_initXMLFile():void {  
this.loader = new LoadXML(“xml/images.xml”, \_onDisplayTest);  
}

public function \_onDisplayTest(evt:Event):void {  
this.xmlData = new XML(evt.target.data);

for(var i:uint=0; i\<this.xmlData.images.length(); i++) {  
this.tab\_test.push({file:this.xmlData.images\*.item.toString(), view:this.xmlData.images\*.object.toString()}) ;   
trace('TabTest: '+this.tab\_test\*.file); // it’s working fine here, I can see datas  
trace('TabView: '+ this.tab\_test\*.view);  
}  
}

XML file:  
\<bitmap\>  
\<images\>  
\<item\>images/img\_01.jpg\</item\>  
\<object\>face1\</object\>  
\</images\>  
\<images\>  
\<item\>images/img\_02.jpg\</item\>  
\<object\>face2\</object\>  
\</images\>  
\</bitmap\>
