sortOn( ) supports sort modifiers : SortOn : Array Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Array » SortOn »

 

sortOn( ) supports sort modifiers


 


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var cars:Array = new Array(  );
        cars.push({make: "H",    year: 1997, color: "maroon"});
        cars.push({make: "Chrysler", year: 2000, color: "beige"});
        cars.push({make: "Mercedes", year: 1985, color: "blue"});
        cars.push({make: "Fiat",     year: 1983, color: "gray"});
        
        cars.sortOn("year", Array.DESCENDING);
             
        for (var i:int 0; i < cars.length; i++) {
          trace(cars[i].color + "t" 
                cars[i].year + "t" 
                cars[i].make);
        }
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Array
» SortOn