AS3 If Statements: If, else if, and else breakdown

if (condition1) {
method;
} else if (condition2) {
method;
} else {
method;
}

//Conditions set by the programmer
//An "else if" will test to see if another condition is met
//If condition is met the methods within the curly braces will be performed
//Notice that "else" does not need a condition

Actionscript:

if (bButton.label==" Turn On" ) {
bButton.label=" Turn Off" ;
mcBulb.visible=true;

} else if (bButton.label==" Turn Off" ) {
bButton.label=" Turn On" ;
}

Leave a Reply