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

Modifying Variables

Variables are useful because you can change their contents with updated information about the status of the movie or your viewer. Sometimes this just involves assigning a new value to the variable. Other times, this means adding, subtracting, multiplying, or dividing its numeric values, or changing a Boolean true value to a false value, or modifying a string by adding characters. For example, the variable myScore could be initialized at 0. Then, for every goal a player makes, the myScore variable changes in increments of 1. The job of modifying information contained in variables falls upon operators—symbols that "operate" on data.

Assignment and Arithmetic Operators

The assignment operator (=) is a single equal symbol that assigns a value to a variable. You've already been using this operator in the action set variable, which automatically puts the assignment operator between the entries of the Variable field and the Value field. You can also use the evaluate action, which gives you an empty Expression field in the Para meters pane; in that field you enter your variable name, a value, and the assignment operator between the two (Figure 9.21). The other common operators appear in Table 9.3.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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