Click SWF to play the example. Right-click
(or Control-click/Mac) FLA to
download the file and see the Timeline, etc.
Note: If you get a Missing Font Warning when you open the FLA
in Flash, it's okay. Click the Use Default button. > Moving Eyeball
The first example of a movie clip is really just a simple animation.
But a movie clip symbol acts like a graphic symbol, or a button
symbol -- so you can place many instances of it on the Stage. The last
"eye" on the left in this example was flipped (Modify menu
> Transform > Flip Horizontal).
SWF :: FLA
> Bonus: Orbits
This example demonstrates how one movie clip can function inside another movie clip. The main Timeline is only one frame. Download and examine the FLA to see how it's done.
SWF :: FLA
> Moving Background, Version 1
The example in the book builds on an animation with buttons from Lesson
5. The three clouds are all in one movie clip. The Stop button
in the movie does not affect the clouds, but if you fly the plane
Right or Left, you'll see that it does control the main Timeline. This
illustrates that the movie clip's Timeline is independent of the
main Timeline.
SWF :: FLA
> Moving Background, Version 2
This example also builds on an animation with buttons from Lesson
5. The three clouds are all in one movie clip, exactly like Version 1 above.
Both the Stop and Play buttons in the movie do not affect the clouds, but they
do control the main Timeline.
SWF :: FLA
> Moving Background, Version 3
For this example, I started with Version 2 above.
I gave the movie clip an instance name (clouds_mc). Then I added one line
of ActionScript on each button to control the movie clip's Timeline, in addition
to the main Timeline. Compare the way the buttons work in Version 3 with the
way they work in Version 2. There is no script in the movie clip.
SWF :: FLA
> Sliding Panel, Version 1
The example in the book includes a graphic (the panel) inside a movie clip (where
the sliding action happens) and two buttons on the main Timeline, which control
the movie clip by addressing its Timeline with an instance
name (slider_mc). Click the green button, then the red button. These buttons
are not perfect, however. If you click either one repeatedly, you'll see the
problem.
SWF :: FLA
> Sliding Panel, Version 2
This variation fixes the problem by adding two lines of ActionScript to each
of two keyframes inside the movie clip. For the ActionScript to work, each
button has been given an instance
name (view_btn and hide_btn). Compare the way these buttons work with Version
1 above.
SWF :: FLA
> Sliding Panel, Version 3
This variation fixes the problem (Version 1) in a different way -- by adding
an "if" condition (in ActionScript) to each button. The condition is changed
by two new lines of ActionScript in the movie clip Timeline. When the playhead
is on Frame 1 in the movie clip Timeline, the condition is true. When the playhead
in the movie clip Timeline moves to the position where the sliding panel is
fully visible, the condition is changed to false. The button "reads" this
condition when you click it, and it does something, or nothing, depending on
whether the condition is true or false.
SWF :: FLA
> Sliding Panel, Version 4
This example is very different from the other three (above): Here, both buttons
are inside the movie clip. This changes the scripting on the buttons.
The green button is on the movie clip Timeline, so it can directly address
that Timeline. The red button is part of the panel -- that means it is inside
the graphic symbol (which itself is inside the movie clip). It must use the
term "_parent" to address the movie clip Timeline.
SWF :: FLA
> Sliding Panel, Version 5
This is the simplest version of a sliding panel. Both buttons appear on the
movie clip Timeline. No "target path" is needed for these buttons.
SWF :: FLA
> Movie Clips Extra
This example includes three different movie clips. One is a sliding panel with
an internal button (really two buttons). Another is a pulsing symbol, which
is very simple to make. The third is a box that expands out when you roll over
a button. The button happens to be invisible (see Lesson
4), and it's on top
of the pulsing movie clip but NOT inside it. The expanding box movie clip is
inside the Over frame of the button.
SWF :: FLA
> Movie Clip as Transition
In this example, I modified the Next/Prev button movie from the examples for
Lesson
5. In the button version, the frames were changed by the buttons. In this
version, the frames are changed by the movie clip, which provides a wipe effect
between frames.
SWF :: FLA
> Bonus 2: Advanced Orbits
If you're ready to learn how ActionScript can control a movie clip that is inisde another movie clip, download the FLA and look at the script on the Moon buttons.
SWF :: FLA
Download all FLA files for this lesson (requires Flash MX
or later):
> Windows (.zip) 86 KB
> Mac (.sit) 84 KB
|