Here is a tip containing a quicker way to sort an ArrayCollection in ActionScript by using the underlying Array sortOn method. By quick I mean less code - I make no statement about performance.

Normally to sort an ArrayCollection you would need to create instances of both the Sort and SortField classes to arrive at something like this (untested code to give you an idea):

view plain
1var sort:Sort = new Sort();
2var sortField:SortField = new SortField(); = "myFieldName";
4sortField.numeric = true;
5sortField.descending = true;
7myCollection.sort = sort;

However since the source property of the ArrayCollection class points to the Array that acts as the source of the Arraycollection's data you can mess with it if you like (it's a bit naughty as you are not meant to do this and your mileage may vary).

So therefore to sort the above example 'myCollection' numerically by 'myFieldName' you could to this:

view plain
1myCollection.source.sortOn('myFieldName', Array.DESCENDING | Array.NUMERIC );

I'm sure someone will tell me off for this but here you go. This worked for me for my purposes and it seems a lot simpler. And I like simple things.