Mega Code Archive

 
Categories / Flash ActionScript / Array
 

Use the Array NUMERIC constant with the sort( ) method to sort an array of numbers numerically

package{   import flash.display.Sprite;      public class Main extends Sprite{     public function Main(){         var scores:Array = [10, 2, 14, 5, 8, 20, 19, 6];         scores.sort(Array.NUMERIC);         trace(scores);   //2,5,6,8,10,14,19,20     }   } }