pogue:mahone,
> What I want to do is use these frames as a basis for a navigation
> tool, where the mouse hovering over any of the disks would trigger
> a certain portion of the animation to play
I can visualize exactly what you mean.
> I?m using CS3. I haven?t done anything much with buttons & actions
> before, which I presume to be the solution here.
Flash is very flexible, so you could use buttons or not. To get the
effect you're after, though -- and because the concept of "button" may help
you as a newcomer -- I'll describe an approach with buttons. Fortunately,
you already have a leg up in regard to the click-and-drag exercise.
> Should the animation be split into 4 seperate clips?
One clip will do, just like before. Lay out your images in sequence in
the movie clip's timeline. Drag your movie clip to the stage and use the
Property inspector to give it an instance name. Remember, the instance name
is what allows ActionScript to speak to this object directly.
While we're on the subject, what sort of object is this? It's a movie
clip, of course. What may not be so obvious is that movie clips are defined
by something called the MovieClip class. (Button symbols are defined by the
Button class; text fields by the TextField class, and so on.) In
ActionScript, and in many programming languages, classes define an object's
functionality. The movie clip sitting in the main timeline is called an
"instance" of the MovieClip class, which perhaps makes some sense of the
term "instance name." Classes tend to define one or more of the following
three categories: properties (characteristics of the object), methods
(things the object can do), and events (things the object can react to).
Think of the Help docs in these terms, and you'll find it much easier to
navigate.
So ... just like the click-and-rotate exercise, you'll put a frame
script in the main timeline that starts like this:
instanceName.stop();
.... where "instanceName" is whatever instance name you decided to you (in
the earlier exercise, this was mc). What you're doing there is invoking the
MovieClip.stop() method on one particular instance of the MovieClip class.
Telling this movie clip to stop on frame 1 assumes that one of its
to-be-clickable faces is now facing the user. That may or may not be true,
given your renderings. If the first clickable face happens to be frame 30,
you could omit the stop() reference in the main timeline -- because you
*want* the movie clip to advance -- and just put a stop() action inside the
movie clip's timeline in frame 30:
// in frame 30 of the movie clip
this.stop();
Again, you're invoking the MovieClip.stop() action on a particular movie
clip instance; it's just that your reference is different. If you're inside
the movie clip, you don't need to mention the movie clip's instance name --
the reference "this" (without quotes) will do. In fact, in this context
(but not always, and it will eventually become clear), you can drop the
"this" reference and simply use:
// in frame 30 of the movie clip
stop();
At this point, you don't have very much interactivity going on. Buttons
will help. Inside the movie clip that contains your image sequence, create
a new layer above the images. This is where your buttons will go. You may
as well create a new layer for your scripts, too, just to keep things
organized.
In the buttons layer -- this is inside the movie clip, remember --
insert a keyframe at the appropriate frame (e.g., 30) and draw a circle (or
whatever shape) to represent the clickable face. Select your shape and
convert it to a button symbol (Modify > Convert to Symbol). Choose Button
as your type, and give it a name. This name isn't the same as an instance
name: it's just a name that labels the asset when it appears in the
library, as all symbols do. Once you've converted the shape to a button
symbol, select the symbol and use the Property inspector to give it an
instance name.
Create keyframes at the appropriate frames for the other faces. Since
you already have a button symbol handy, re-use that one: drag the same
button symbol to each new keyframe and postion it over the cube's face.
Give each button a unique instance name.
It'll be easiest to put your code inside the timeline of this movie
clip, rather than the main timeline. Insert keyframes in your scripts layer
at each of the button frames. Enter the following code into each script
keyframe:
// frame 30
stop();
buttonIntanceNameA.onRelease = function():Void {
play();
}
// frame 60
stop();
buttonIntanceNameB.onRelease = function():Void {
play();
}
// etc.
.... where buttonInstanceNameA, B, etc. are the actual instance names of your
buttons.
Test so far (Control > Test Movie), and you'll see that the movie clip
plays until it hits the stop() method in frame 30. When you click button A,
the movie clip will play again until it hits the stop() method in frame 60,
and so on.
> Do I use invisible buttons? I have no idea where to start.
Invisible would be good; otherwise, your cube faces will look horrible
when the buttons appear. Double-click the button asset in your library to
enter its timeline. You'll see four frames: Up, Over, Down, and Hit. Drag
your artwork from the Up frame to the Hit frame. That makes your button
invisible when you create the SWF (artwork in Hit frame only).
This scratches the surface, but it should give you a good start. Like
you said, you're going to want to "just learn ActionScript," because that's
what will unleash your creativity.
David Stiller
Adobe Community Expert
Dev blog,
http://www.quip.net/blog/
"Luck is the residue of good design."
>> Stay informed about: help a total newbie :)