• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Controlling Information Flow > Branching Conditional Statements

Branching Conditional Statements

If you have multiple possible conditions and just as many consequences, then you need to use more complicated branching conditional statements that a single else statement can't provide. For example, if you create an interface to a Web site or a game that requires keyboard input, you would want to test which keys are pressed and respond appropriately to each of them. Flash gives you the else if statement, lets you construct multiple conditions and responses in the following syntax:

If (condition1) {

        consequence1;

} else if (condition2) {

        consequence2;

} else if (condition3) {

        consequence3;

}


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint