# Associative Array vs Data Object

**URL:** <https://forum.kirupa.com/t/associative-array-vs-data-object/268716>\
**Category:** flash\
**Created:** [August 17, 2008, 10:03pm UTC](https://forum.kirupa.com/t/associative-array-vs-data-object/268716 "2008-08-17T22:03:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RebuiltJorge](https://avatars.discourse-cdn.com/v4/letter/r/94ad74/32.png) [@RebuiltJorge](https://forum.kirupa.com/u/RebuiltJorge)\
**Post date:** [August 17, 2008, 10:03pm UTC](https://forum.kirupa.com/t/associative-array-vs-data-object/268716/1 "2008-08-17T22:03:11Z")

</div>

Lately I have been getting into associative arrays and quickly found out that there doesn’t seem to be a way to loop through one, for example:

```auto

var myArray:Array = new Array();
myArray['constructor_stage'] = new Array(0xFFFF00,100,200,"Level1");
myArray['engineering_stage'] = new Array(0xFF0000,440,550,"Level3");

```

normaly you would do something like this, of course it doesn’t work:

```auto
for(var i:int = 0; i < myArray.length; i++){}

```

I went to live docs and they said to use the object class, so is there a way to loop through an object data properties:

```auto

var dataObject:Object = {player1:{userName:"theUserName",password:"thePassword"},player2:{"theUserName",password:"thePassword"}}

```
