Searching through an array in AS3

Search for a value in Actionscript 3.

var myArray = new Array("bob", "jimmy", "sue");
var searchForJimmy = function (searchValue) {

trace("searching for: "+searchValue+" array length: "+myArray.length);

for (var i=0; i < myArray.length;i++)
{
   if (searchValue == myArray[i]) {
      trace("found "+searchValue+" at array # "+i);
   }
}
}
This entry was posted in ActionScript 3.0 and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>