# Array help \[flash 8\]

**URL:** <https://forum.kirupa.com/t/array-help-flash-8/184110>\
**Category:** flash\
**Created:** [April 2, 2006, 2:52am UTC](https://forum.kirupa.com/t/array-help-flash-8/184110 "2006-04-02T02:52:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brighteyes](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@brighteyes](https://forum.kirupa.com/u/brighteyes)\
**Post date:** [April 2, 2006, 2:52am UTC](https://forum.kirupa.com/t/array-help-flash-8/184110/1 "2006-04-02T02:52:51Z")

</div>

Can anyone tell me why this doesn’t work.  
It is almost directly taken from here- [http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary069.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary069.html)

```
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000] **var** [/COLOR] recArray = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000FF]Array[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];

```

recArray.[COLOR=#0000FF]push[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]{[/COLOR][COLOR=#0000FF]name[/COLOR]:[COLOR=#FF0000]“bob”[/COLOR], city:[COLOR=#FF0000]“omaha”[/COLOR], zip:[COLOR=#000080]68144[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];  
recArray.[COLOR=#0000FF]push[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]{[/COLOR][COLOR=#0000FF]name[/COLOR]:[COLOR=#FF0000]“greg”[/COLOR], city:[COLOR=#FF0000]“kansas city”[/COLOR], zip:[COLOR=#000080]72345[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];  
recArray.[COLOR=#0000FF]push[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]{[/COLOR][COLOR=#0000FF]name[/COLOR]:[COLOR=#FF0000]“chris”[/COLOR], city:[COLOR=#FF0000]“burlingame”[/COLOR], zip:[COLOR=#000080]94010[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];  
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR];  
[/LEFT]  
[/FONT]

This is what it traces: [object Object],[object Object],[object Object]

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [April 2, 2006, 3:15am UTC](https://forum.kirupa.com/t/array-help-flash-8/184110/2 "2006-04-02T03:15:40Z")

</div>

It does work - when tracing objects Flash calls the toString method of that object which, in this case, returns _[object Object]_ 😉

Use this to see all of the properties of each object:

```auto
var recArray = new Array();
recArray.push({name:"bob", city:"omaha", zip:68144});
recArray.push({name:"greg", city:"kansas city", zip:72345});
recArray.push({name:"chris", city:"burlingame", zip:94010});
recArray.sortOn("city");
for (var i:Number = 0; i < recArray.length; i++) {
 trace("recArray[" + i + "]: ");
 for (var prop in recArray*) {
  trace("	" + prop + ": " + recArray*[prop]);
 }
}

```

Hope this helps :hoser:

---

<div class="post-metadata">

**Author:** ![brighteyes](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@brighteyes](https://forum.kirupa.com/u/brighteyes)\
**Post date:** [April 2, 2006, 3:40am UTC](https://forum.kirupa.com/t/array-help-flash-8/184110/3 "2006-04-02T03:40:39Z")

</div>

> [@TheCanadian](#):
>
> It does work - when tracing objects Flash calls the toString method of that object which, in this case, returns _[object Object]_ 😉
> 
> Use this to see all of the properties of each object:  
> ActionScript Code:  
> [FONT=Courier New][LEFT][COLOR=#000000] **var** [/COLOR] recArray = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000FF]Array[/COLOR]COLOR=#000000[/COLOR];  
> recArray.[COLOR=#0000FF]push[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]{[/COLOR][COLOR=#0000FF]name[/COLOR]:[COLOR=#FF0000]“bob”[/COLOR], city:[COLOR=#FF0000]“omaha”[/COLOR], zip:[COLOR=#000080]68144[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];  
> recArray.[COLOR=#0000FF]push[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]{[/COLOR][COLOR=#0000FF]name[/COLOR]:[COLOR=#FF0000]“greg”[/COLOR], city:[COLOR=#FF0000]“kansas city”[/COLOR], zip:[COLOR=#000080]72345[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];  
> recArray.[COLOR=#0000FF]push[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000]{[/COLOR][COLOR=#0000FF]name[/COLOR]:[COLOR=#FF0000]“chris”[/COLOR], city:[COLOR=#FF0000]“burlingame”[/COLOR], zip:[COLOR=#000080]94010[/COLOR][COLOR=#000000]}[/COLOR][COLOR=#000000])[/COLOR];  
> recArray.[COLOR=#0000FF]sortOn[/COLOR]COLOR=#000000[/COLOR];  
> [COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000] **var** [/COLOR] i:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]0[/COLOR]; i \< recArray.[COLOR=#0000FF]length[/COLOR]; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
> [COLOR=#0000FF]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]“recArray[”[/COLOR] + i + [COLOR=#FF0000]“]: “[/COLOR][COLOR=#000000])[/COLOR];  
> [COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000] **var** [/COLOR] prop [COLOR=#0000FF]in[/COLOR] recArray[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
> [COLOR=#0000FF]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]”[COLOR=#000099]\*\* \*\*[/COLOR]”[/COLOR] + prop + [COLOR=#FF0000]": "[/COLOR] + recArray[COLOR=#000000][[/COLOR]i[COLOR=#000000]][/COLOR][COLOR=#000000][[/COLOR]prop[COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];  
> [COLOR=#000000]}[/COLOR]  
> [COLOR=#000000]}[/COLOR]  
> [/LEFT]  
> [/FONT]
> 
> Hope this helps :hoser:

Thank you!!!  
It all makes sense now…

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [April 2, 2006, 3:44am UTC](https://forum.kirupa.com/t/array-help-flash-8/184110/4 "2006-04-02T03:44:08Z")

</div>

Welcome 🍺
