# Re-ordering Associative array on its Keys

**URL:** <https://forum.kirupa.com/t/re-ordering-associative-array-on-its-keys/299031>\
**Category:** flash\
**Created:** [October 28, 2009, 8:10pm UTC](https://forum.kirupa.com/t/re-ordering-associative-array-on-its-keys/299031 "2009-10-28T20:10:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raabi](https://avatars.discourse-cdn.com/v4/letter/r/41988e/32.png) [@Raabi](https://forum.kirupa.com/u/Raabi)\
**Post date:** [October 28, 2009, 8:10pm UTC](https://forum.kirupa.com/t/re-ordering-associative-array-on-its-keys/299031/1 "2009-10-28T20:10:42Z")

</div>

Hello

Working first time with the Associative arrays, I could not find a way to re-order the array based on its Keys. I used the following code to retrieve the data from the array “arrHues”:

```auto
 
   for (var prop: String in arrHues)
   {     
       strCodes += (prop + " = " + arrHues[prop]) + "
";
   } 
trace (strCodes);

```

But, the output is un-ordered and hard to compare or locate the items of interest.

Also, is there a way to find the count of elements in this array - without adding a counter inside the for loop.

Any suggestion, please!
