Hey, the following code is from a Kirupa Tutorial, but i was wondering if there was a way of checking once an item is found in the array, where it is located in the array.
ie 20 is coOrdinates [0];
coOrdinates = new Array ();
coOrdinates.push (20, 21, 22);
contains = function (input, coOrdinates) {
for (i=0; i< coOrdinates.length; i++) {
if (coOrdinates* == input) {
return 1;
}
}
return -1;
};
if(contains( 20 ,coOrdinates)==1) {
trace(“I’m here”);