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

Chapter 9. Controlling Information Flow > Testing Information with Conditional ...

Testing Information with Conditional Statements

Variables and expressions go hand in hand with conditional statements. The information you retrieve, store in variables, and modify in expressions will be useful to you only when you can compare it with other pieces of information. Conditional statements let you do this kind of comparison and carry out instructions based on the results. The logic of conditional statements is like the sentence “If abc is true, then do xyz,” and in Flash, you define abc (the condition) and xyz (the consequence).

Conditional statements begin with the statement if(). The parameter that goes between the parentheses is the condition— a statement that compares one thing with another. Is the variable myScore greater than the variable alltimeHighScore ? Is the _droptarget property for my draggable movie clip unequal to the target path for the garbageCan movie clip? Does the _currentFrame property of the root Timeline equal 10? These are typical examples of conditions.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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