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

Chapter 15. Using Basic ActionScripts > Using Conditional Statements

Using Conditional Statements

Conditional statements in ActionScript are a critical part of interactivity. It lets you program a script based on any number of conditions. For example, in the morning, you say good day, or good morning to someone you meet. In doing so, you made a conditional choice.

ActionScript does the same thing. You can create an ActionScript that checks the time of day. If it's before noon, Flash responds with a Good Morning message, if it's from noon to 5, say Good Afternoon, or after 5 till midnight, say Good Evening. This type of condition is known as an if/else condition. If this happens do this… else do that. Since a variable can be almost anything you can measure on a computer, and a conditional statement is made up of two or more variables, ActionScript can be taken to a point where it almost thinks for itself. The previous example could be expressed in flow charting the following way:


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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