Posted By

scottwatkins on 04/22/11


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

shockway


AS3 Is In Array?


 / Published in: ActionScript 3
 

  1. /**
  2.  * _isInArray
  3.  * Checks to see if a supplied element is in an array.
  4.  * the indexOf function returns -1 if it doesn't find the
  5.  * element in array, so we check if indexOf returns 0 or greater.
  6.  *
  7.  * @param element * (any object) The element we are checking for
  8.  * @param array Array The array to see if element is in
  9.  * @return Boolean True if element is found in array, False if not
  10.  * @access private
  11.  */
  12. private function _isInArray(element:*, array:Array):Boolean
  13. {
  14. return (array.indexOf(element) >= 0);
  15. }

Report this snippet  

You need to login to post a comment.