![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
Statements that check whether a condition is true
or false
begin with the term if
. If the condition exists, ActionScript executes the statement that follows. If the condition doesn't exist, ActionScript skips to the next statement outside the block of code.
To optimize your code's performance, check for the most likely conditions first.
The following statements test three conditions. The term else if
specifies alternative tests to perform if previous conditions are false.
if (password == null || email == null) { gotoAndStop("reject"); } else if (password == userID){ gotoAndPlay("startMovie"); }
If you want to check for one of several conditions, you can use the switch
statement instead of using multiple else if
statements.
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |