Reputation: 5018
How can i accomplish sorting an array according to two values. Is there built in function for that?
Upvotes: 1
Views: 1124
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