Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AS3 numerical array sorting?

var dataArray:Array = [ 5, 6, 3, 8, 10, 11, 32, 2 ];
var dataObjectArray:Array [ { "uid": 5 }, { "uid": 6 .... Similar to above ... } ];

I have the above 2 arrays in AS3. and i wish to sort them numerically (1 ~ X) in order [Skipping those that does not exist]. What is the best and most efficent way to do so for dataArray / dataObjectArray.

You may solve 1, or both =)

like image 206
PicoCreator Avatar asked Nov 30 '22 08:11

PicoCreator


1 Answers

Have you tried:

dataArray.sort(  Array.NUMERIC );
dataObjectArray.sortOn( ["uid"], [Array.NUMERIC]); 
like image 122
goliatone Avatar answered Dec 17 '22 14:12

goliatone