CONDITIONALS
Conditionals let us set up the terms or “conditions” for when we want something to be done or under what circumstance a section of code should be executed. Conditionals help Flash make logical decisions.
IF
If (condition is met) {
then execute this code;
}
OR
if (raining == true) {
bring umbrella;
}
OR
if (x == 1) {
gotoAndPlay(2);
}
ELSE
You can also include an ELSE statement (or if else). This means if the condition is not met, then do something else:
if (raining == true) {
bring umbrella;
}
else {
wear winter coat;
}
OR
if (x == 1) {
this.gotoAndPlay(10);
}
else {
this gotoAndPlay(20);
}
OPERATORS
We use operators to make comparisons above, such as-
== (equal to)
!= (not equal to)
< > (less than or greater than)
<= (less than or equal to)
>= (greater than or equal to)
&& (use this to check for multiple conditions)
|