# Sorting a multidimensional array

**URL:** <https://forum.kirupa.com/t/sorting-a-multidimensional-array/303124>\
**Category:** Uncategorized\
**Created:** [January 14, 2010, 11:23am UTC](https://forum.kirupa.com/t/sorting-a-multidimensional-array/303124 "2010-01-14T11:23:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrpercival](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@mrpercival](https://forum.kirupa.com/u/mrpercival)\
**Post date:** [January 14, 2010, 11:23am UTC](https://forum.kirupa.com/t/sorting-a-multidimensional-array/303124/1 "2010-01-14T11:23:18Z")

</div>

I have a multidimensional array that looks like this:

```auto

var Tracker:Array = new Array();

Tracker[mc.name] = new Array(2);
Tracker[mc.name][0] = someNum;
Tracker[mc.name][1] = someString;

```

where mc.name is a series of dynamically created sprites.

what I am trying to do is sort the mc.names into order based on what the value of Tracker[mc.name][0] is. (if that makes sense)

I am looking at the : SampleArray.sortOn(“0”,Array.NUMERIC); but it doesnt seem to work as I had hoped, so im not sure if im doing something wrong or just not understanding how it works etc

I just need the mc.name’s to be reordered into the numerical order from the numbers in the[0] and keep the right mc.name with the numbers.

Im not sure im been very clear here, but hopefully someone will know what i mean!

Thanks for your help.
