Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: [flasher] Movie Clip in a button
From: AndyA
Date: Sat, 24 Feb 2001 08:09:14 -0000

Hey Erik,

The command gotoAndPlay() will always act on the timeline in which it is
programmed. The button has its own four frame timeline. So
gotoAndPlay("Up"), would tell the button to go to the frame labelled "Up" in
this timeline. If you want to reference another timeline such as the main
timeline (or _root as it is called) in which you have put your button you
need to use the tellTarget() command.

For example, you could create a second frame in the main timeline with the
navbar rolled out and the extra rollover buttons. In both of the frames in
the main timeline put a stop action. Then using the following code:

tellTarget (_root) {
gotoAndPlay (2)
}

will tell the main timeline to go to frame 2.

Since you have put a movie clip in the 'over' frame of the button, you have
created a hierarchy of timelines that looks like this:

_root
button
movieclip

The hierarchy can be used to target accurately too. So, if you had a
Movieclip on the main timeline you could use the 'instance' panel to give
the movieclip an instance name of e.g. Movie1. The hierarchy would then be:

_root
Movie1

If you then wanted to tell the movieclip Movie1 to do something you can use:

tellTarget (_root.Movie1) {statement}

Similarly, if you put another movieclip in a fram in Movie1, then the
hierarchy would be:

_root
Movie1
Movie2

and this one could be referred to as _root.Movie1.Movie2 etc.

If you go to "Window - Help" in flash and search for TellTarget, you'll find
lots more info. You might also want to look at gotoAndStop.

I haven't found a way of giving a button an instance name though, so you
cannot target the button timeline from somewhere else (if anyone knows how
to do this, I'd love to know!!). As a result, you might want to look at the
possibility of making your NavBar a MovieClip instead of it being a button.
To get the rollover action in your new Navbar movieclip, you can include an
invisible button (one with just the "Hit" frame specified and no content).
Have a play with the idea and see what you come up with!

Regards

Andy




[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]