Copy link to clipboard
Copied
Hello, I know this is probably a very obvious question, but I'm new to flash.
Can I do something like,
if (jellyfish == 3, 74, 95, || 1006) {
//Do Stuff
}
Or would I have to do:
if (jellyfish == 3 || jellyfish == 74 || jellyfish == 95 || jellyfish == 1006) {
//Do Stuff
}
Let me know if there is something closer to the first one, or if I'm going to have to have pages within one if statement.
Thanks,
Christopher
you must do the latter, but if it's worthwhile you can use a for-loop:
var a:Array=[3,74,95,1006];
for(var i:Number=0;i<a.length;i++){
if(jellyfish==a){
//do stuff
break;
}
}
Copy link to clipboard
Copied
you must do the latter, but if it's worthwhile you can use a for-loop:
var a:Array=[3,74,95,1006];
for(var i:Number=0;i<a.length;i++){
if(jellyfish==a){
//do stuff
break;
}
}
Copy link to clipboard
Copied
Thank you so much!
This is exactly what I needed!
You were missing a parenthisis, but besides for that, it works beautifully and looks a lot more visually appealing!
Copy link to clipboard
Copied
you're welcome.
(and i corrected that paranthesis in case someone else copies that code.)
Copy link to clipboard
Copied
The second is the correct way to specify multiple conditions
Copy link to clipboard
Copied
I know it is correct, but I was wondering if there was a simpler way.
Thanks for the help, though.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now