Getting Sorted Indices : Sort : Array Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Array » Sort »

 

Getting Sorted Indices


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var aEmployees:Array = ["A""P""C""H"];
        var aSortedIndices:Array = aEmployees.sort(Array.RETURNINDEXEDARRAY);
        trace(aEmployees.toString());
        trace(aSortedIndices.toString());
        for(var i:Number = 0; i < aSortedIndices.length; i++) {
          trace(aEmployees[aSortedIndices[i]]);
        }
    }
  }
}
/*
A,P,C,H
0,2,3,1
A
C
H
P
*/

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Array
» Sort