/ Published in: ActionScript 3
I have fixed and improved some code I found on the Internet
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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);