Game Development Reference
There are two other important properties from the table at the beginning of this chapter that you
haven't yet used in the little interactive cat toy:
]hld] : controls the transparency of an object and accepts values from 0 (completely transpar-
ent) to 1 (completely opaque, or solid)
t : controls the horizontal position of an object, and like its partner-in-crime, the u property,
accepts values in pixels
The functionality of these properties is very similar to the properties you already used. So, here's
a little assignment for you. How about building a pair of buttons that move the cat left and right, and
another pair that gradually makes the cat disappear and reappear? I'm sure you can figure it out! Also
experiment with the 3D properties v, nkp]pekjT, nkp]pekjU, nkp]pekjV, and o_]haV.
Have fun, and I'll meet you at the next section when you're done.
Controlling Movie Clip timelines
Movie Clip properties give you a great deal of control over how objects behave, and even very basic
examples like these can hold a lot of appeal if they're used in the right context. In the next section of
this chapter, you'll look at how you can take your control of Movie Clip objects one step further by
controlling the timeline.
You'll add another character to the storybook: a friendly frog who sits on an island in the pond. You'll
set the interactive storybook up so that when the reader clicks the frog, the frog asks the cat
As with anything as complex as computer programming, there are many ways to do this. The approach
you'll take with this example is to use the Movie Clip object's timeline to define different states for
the frog. In fact, you're going to be creating something that, in computer programming terminology,
is called a state machine .
By states I refer to “states of being.” If you think of something as simple as a light bulb, it has two
states: on or off. Think of something a little more complex: your little sister has a whole range of
states such as happy, bored, amused, frustrated, food-throwing, and so on. I'm sure you can think of
many more! A state machine is a list of all these states and a mechanism for getting from one state
State machines are a very complex topic in the field of computer science, and building them from
code is a highly skilled art. However, one huge bonus that Flash has as a game design and programming
platform is that it has an extremely usable state machine built right into it. It's called the timeline.
If you're new to Flash, the timeline is a long numbered strip of little boxes (called frames ) that you
can see if you click the Timeline tab just below the stage. When it's empty, it looks like Figure 4-17.
Figure 4-17. An empty timeline