atilkan
atilkan

Reputation: 5018

Array Sorting according to two or more values

How can i accomplish sorting an array according to two values. Is there built in function for that?

Upvotes: 1

Views: 1124

Answers (2)

atilkan
atilkan

Reputation: 5018

Answer:

In my loop I insert values into my array like so:

for(var i:uint = 0; i < xmlList.length(); i++)
{
    sortArray[i].year = xmlList[i].year;
    sortArray[i].month = xmlList[i].month;
}

And to sort this array: (edited)

sortArray.sortOn(['year', 'month'], [Array.NUMERIC, Array.NUMERIC]);

Upvotes: 3

Eugeny89
Eugeny89

Reputation: 3731

Use the sortOn() function.

Upvotes: 5

Related Questions