Chapter 9. Controlling Information Flow

As your Flash movie displays graphics and animation and plays sounds, a lot can be happening behind the scenes, unapparent to the viewer. Your Flash document may be tracking many bits of information, such as the number of lives a player has left in a game, a user’s login name and password, or the items a customer has placed in a shopping cart. Getting and storing this information requires variables, which are containers for information. Variables are essential in any Flash movie that involves complex interactivity because they let you create scenarios based on information that changes. You can modify variables and use them in expressions—formulas that can combine variables with other variables and values—and then test the information against certain conditions to determine how the Flash movie will unfold. This testing is done in conditional statements, which control the flow of information. Conditional statements are the decision makers of your Flash movie; they evaluate information that comes in and then tell Flash what to do based on that information. You would use conditional statements to make a ball bounce back if it collides with a wall, for example, or to increase the speed of the ball if the game time exceeds 1 minute.

This chapter is about managing information by using variables, expressions, and conditional statements. You’ve dealt with all three in limited ways in earlier chapters, but here, you’ll learn how to work with them in more detail. When you understand how to get, modify, and evaluate information, you can truly direct your Flash movie and change the graphics, animation, and sound in dynamic fashion.