AS3 Is In Array?


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.