Game Development Reference
In-Depth Information
The first directive uses the Ikrea?hel class's ckpk=j`Opkl$% method:
lkj`L]ca*bnkc* ckpk=j`Opkl$.% 7
ckpk=j`Opkl is a method that is available to all Movie Clip objects. It's used to tell the object to go
to and stop at a specific frame on the object's timeline. The number in the parentheses is the frame
number that you want the timeline to go to. In this case, it's frame 2, which is the frog's open mouth
state. For a children's storybook, this is a nice effect because when the reader examines the page, the
frog's mouth opens when the mouse skims over it. This immediately signals that the frog is an interac-
tive object and it tempts the reader to click it.
Instead of using frame numbers, it's also possible to use something called frame
labels . Frame labels are descriptive words or phrases that you can use to describe
frames in your timeline.
To create a frame label, create a new layer in the timeline of the FLA file called labels .
The labels layer is usually at the very top of the layer stack so that you can see the label
names clearly. You then insert a keyframe wherever you want to add a label, such as
at a new state. In the Properties panel you'll see a pane called Label with a Name box
in which you can enter the label name. The name you enter appears on the timeline
at the keyframe where you assigned it, along with a tiny red flag that tells you that
it's a frame label. Figure 4-28 shows an example of what a timeline with frame labels
might look like.
Figure 4-28. Using frame labels in the timeline
To use the ckpk=j`Opkl$% method with any frame label you create, include the name
of the frame, surrounded by quotes, as part of method's argument, like this:
There's nothing intrinsically wrong with using frame labels. In fact, they're a really
nice feature, especially if you just use them as way of reminding yourself what state
each frame represents. But if you're doing a lot of coding (and as a game designer, you
are!), you should avoid making your code dependent on them. Your programs will be
a little more bug-proof if you use frame numbers because they're easier to manage,
easier to manipulate, and can't be misspelled.
The next directive in the kjBnkcIkqoaKran event handler is this line:
lkj`L]ca*bnkc*naikraArajpHeopajan$IkqoaArajp*IKQOA[KRAN( ±
Search Nedrilad ::

Custom Search