sr817,
[quoted text, click to view] > is there a way to have a button from one movie clip (say a button
> from the bottom navigation bar) perform an action on one of the
> other movieclips I have organized in my flash document.
You bet. The "trick" is to give each of your movie clips an instance
name, then use that instance name in your ActionScript to tell each clip
what to do. Not all, but many objects can be given instance names via the
Property inspector. In your case, you'll select each movie clip on the
Stage by clicking on it once, then looking at the Property inspector while
each is selected.
Under the hood, movie clip symbols are instances of the MovieClip class
(button symbols, in ActionScript 2.0, are instance of the Button class, and
in ActionScript 3.0 are intances of the SimpleButton class). Non-static
text fields are instances of the TextField class, and so on. Classes define
objects, so you can find the functionality that each supports by looking up
the relevant class entry in the ActionScript 2.0 or 3.0 Language Reference
in the Help docs (AS3 is only available since Flash CS3). You'll generally
find three categories: properties (characteristics the object has), methods
(things the object can do), and events (things the object can react to).
For example, you'll find the MovieClip.gotoAndPlay() method under the
Methods heading of the MovieClip class. In actual pratice, you'll invoke
that method against the instance name desired:
myClip.gotoAndPlay(15);
[quoted text, click to view] > In very simple computer terms, once I move them onto the actual
> document window rather than editing the actual movie clips in my
> library, the frame number no longer corresponds to the actual length
> of each of the clips (a 200 frame movie clip appears as a single frame)
That's right -- an that's perfectly fine. ActionScript in keyframes of
the main timeline, where each of these movie clips resides, needn't worry
about the timeline it's in. (When it does, it's invoking MovieClip methods
on the main timeline itself ... it's not immediately obvious, but the main
timeline effectively *is* one big movie clip symbol.)
[quoted text, click to view] > and button instances do not seem to work together unless located in
> the same library clip.
Buttons will need their own instance names. If you have three
buttons -- myBtnA, myBtnB, and myBtnC -- inside a movie clip with the
instance name myClip2, then you would reach the "B" button like so from the
main timeline:
myClip2.myBtnB
.... and you could then invoke Button (or SimpleButton) class members on it.
If you're using ActionScript 2.0 (I'm just guessing), then you might handle
a Button.onRelease event like this:
myClip2.myBtn2.onRelease = function():Void {
// do something here
}
If this "B" button is supposed to send the timeline of myClip1
somewhere, it might look like this (again, all this code is in a keyframe of
the timeline that contains these clips and their nested buttons) ...
myClip2.myBtn2.onRelease = function():Void {
myClip1.gotoAndPlay(33);
}
In the above example, a function is assigned to the Button.onRelease
handler of the myBtn2 instance, which resides inside the myClip2 instance.
The function asks myBtn2 to look for yet another instance named myClip1.
The function will look for this reference inside itself first, won't find
it -- because no variable has been named myClip1 inside itself -- will then
look "up the chain," so to speak, in myClip2 and won't find it, and will
finally look up the chain again to the timeline that contains both myClip2
and myClip1, at which point it will make the connection and tell myClip1
what to do.
David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj "Luck is the residue of good design."