From: AdobiMyHobby on
Dear All;
Is it possible to stop a nested movie clip from the main timeline?
I tried to stop the whole animation by a single stop button, but only the
movie clips on the main timeline stopped except the nested ones continued
looping.

Any solution to this problem is highly appreciated.

Thank you,

AdobeLover

From: David Stiller on
AdobiMyHobby,

> Is it possible to stop a nested movie clip from the main timeline?

Sure thing. :)

> I tried to stop the whole animation by a single stop button, but only
> the movie clips on the main timeline stopped except the nested
> ones continued looping.

That happens because movie clips have their own independent timelines
(as opposed to, say, graphic symbols, whose inner timelines are locked to
the timelines in which they appear). When you put a stop() action on the
main timline, you're only stopping a single movie clip -- namely, the main
tmeline. It may not be immediately apparent, but the main timeline is a
movie clip, just like any movie clip symbol.

If you want to stop the timeline of a movie clip symbol, you need to
reference that symbol by name and tell it to stop. The name you need in
order to make that reference is called an "instance name," which is
something you can provide by selecting the movie clip and looking at the
Property inspector.

Instance names allow ActionScript to make direct references to
objects -- it's like giving ActionScript a roster -- and then you can check
(or change) properties of these objects, such as position, width or height;
tell objects what to do, by way of a mechanism called methods; and tell
objects how to react to things, by way of a mechanism called events.

Properties, methods, and events are listed for each type of object in
that object's definition, which is called a class. If you want to see what
methods are available for movie clips, look up the MovieClip class in the
Help panel. For text fields, look up the TextField class, and so on. Most
of them will be familiar to you; for example, the MovieClip class features
stop(), play(), gotoAndStop() methods (plus more).

To stop the main timeline and all your nested movie clips, you simply
have to invoke MovieClip.stop() on each of them. For the main timeline,
it's enough to mention the method:

stop();

.... the reference to the movie clip -- that is, the timeline -- is inferred,
because your code is in a keyframe of the main timeline. If you've given
one of your movie clip symbols the instance name frogHopper, then your
ActionScript would look likethis:

frogHopper.stop();


David Stiller
Co-author, Foundation Flash CS3 for Designers
http://tinyurl.com/2k29mj
"Luck is the residue of good design."



From: rritchey on
You need to use instance names to do this.

The movieClip on the main timeline, as well as any nested movieClips need to
have an instanceName. You would then stop them as follows:

mainTimelineMC.nestedMC.stop();

You can use this path to go as deep as you need. ( IE
mTMC.nMC.nMC.nMC.nMC.stop(); )

From: AdobiMyHobby on
Thank you for your abropt reply
shall i put it inside a button's event handler?.

Thank you again
From: David Stiller on
AdobiMyHobby,

>> mainTimelineMC.nestedMC.stop();

> shall i put it inside a button's event handler?.

If you don't, the code will execute as soon as the playhead enters that
frame.


David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."