Revision: 6432
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 21, 2008 05:21 by ozke
Initial Code
public function orderNumerically(a, b):Number{
// Change a[0] & b[0] by a[i] & b[i]
// (where i is the array index you want to use to sort the multidimensional array)
var num1 = Number(a[0]);
var num2 = Number(b[0]);
if(num1<num2){
return -1;
}else if(num1>num2) {
return 1;
}else{
return 0;
}
}
the_array.sort(orderNumerically);
Initial URL
Initial Description
I have fixed and improved some code I found on the Internet
Initial Title
Sort multidimensional arrays in AS3 (numerically)
Initial Tags
sort, array
Initial Language
ActionScript 3