# Why is my array length 0

**URL:** <https://forum.kirupa.com/t/why-is-my-array-length-0/256043>\
**Category:** Uncategorized\
**Created:** [March 29, 2008, 7:16pm UTC](https://forum.kirupa.com/t/why-is-my-array-length-0/256043 "2008-03-29T19:16:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lldj15](https://avatars.discourse-cdn.com/v4/letter/l/e47c2d/32.png) [@lldj15](https://forum.kirupa.com/u/lldj15)\
**Post date:** [March 29, 2008, 7:16pm UTC](https://forum.kirupa.com/t/why-is-my-array-length-0/256043/1 "2008-03-29T19:16:02Z")

</div>

I am push iems int the array but outside the functio it s zero, the declaration is of global scope. thanks for any help  
var xmlLoader:URLLoader = new URLLoader();  
var xmlData:XML = new XML();  
var imagelist:XMLList=new XMLList();  
var imageArray=[];  
var numberofItems:Number;

xmlLoader.load(new URLRequest(“[http://localhost/flash/loadXML.xml"+"?uniq=](http://localhost/flash/loadXML.xml%22+%22?uniq=)” + new Date().getTime()));

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);  
function LoadXML(e:Event):void {  
[//XML.ignoreWhitespace](https://XML.ignoreWhitespace) = true;  
xmlData = new XML(e.target.data);  
parseImg(xmlData);

}  
function parseImg(imgxml:XML):void{  
imagelist=imgxml.data.productdata.pid

```
for each (var item:String in imagelist){ 
imageArray.push(item)

}

```

}  
trace(imageArray.length)
