# Why doesnt this work?

**URL:** <https://forum.kirupa.com/t/why-doesnt-this-work/204789>\
**Category:** Uncategorized\
**Created:** [October 23, 2006, 3:28pm UTC](https://forum.kirupa.com/t/why-doesnt-this-work/204789 "2006-10-23T15:28:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tedc](https://avatars.discourse-cdn.com/v4/letter/t/5fc32e/32.png) [@tedc](https://forum.kirupa.com/u/tedc)\
**Post date:** [October 23, 2006, 3:28pm UTC](https://forum.kirupa.com/t/why-doesnt-this-work/204789/1 "2006-10-23T15:28:39Z")

</div>

```auto

stop();
xml = new XML();
xml.ignoreWhite = true;
xml.onLoad = function(ok) {
	avAll = this.firstChild.childNodes;
	avStates = new Array();
	for (var i = 0; i<avAll.length; i++) {
		avStates.push(avAll*.attributes.state);
	}
	avStates = avStates.removeDuplicates();
	for (Item in avStates){
		//trace(avStates[Item]);
		k = 0;
		avStates[k] = new Array();
		for (j in avAll){
			if (avStates[Item] == avAll[j].attributes.state){ 
				avStates[Item][k] = avAll[j].attributes.city;  
				k++;
			}
		}
	}
}

```

```auto
trace(avStates[0][0]); //returns undefined (should return san_francisco)

```

```auto
trace(avStates[0]); //returns california 

```

What am I doing wrong?
