Hey…I’m doing a simple array test…I thought I could have values in an array and then run it through a loop and have a IF this value equals “x” do whatever, ELSE do this.
I have the value on a button and it doesn’t work. The loop runs but the IF ELSE statement doesn’t do what I THOUGHT it should do. It runs every value through the script as if the IF ELSE statement doesn’t matter. Am I missing something?
Here’s the flash code (see below):
var myArr:Array = new Array;
myArr = [“red”, “green”,“blue”];
function checkArr (checkTest){
for(i= 0; i<myArr.length;i++){
if (checkTest == myArr*){
trace("Value HIT" + myArr);
} else {
trace("NON Value HIT " + myArr);
}
}
}
red.onPress = function(){
checkArr(“red”);
}