Search array elements : Search : Array Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Array » Search »

 

Search array elements


 


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){


        var soundtracks:Array = ["e""h","p""a""c"];
        
        for (var i:int 0; i < soundtracks.length; i++) {
          trace("Now examining element: " + i);
          if (soundtracks[i== "h") {
            trace("The location of 'h' is index: " + i);
            break;
          }
        }
    }
  }
}
Now examining element: 0
Now examining element: 1
The location of 'h' is index: 1

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Array
» Search