How to control the main timeline from a movieclip

I've seen people searching all over the internet for a way to control the main timeline from inside a movieclip. Well, here it is!

To enter Pause mode:

Code
MovieClip(root).gotoAndStop(MovieClip(root).currentFrame);


To enter play mode:

Code
MovieClip(root).gotoAndPlay(MovieClip(root).currentFrame);



Possible Application

In the code below, IsPlayMode() is your own function that tracks the current Play/Pause mode. This could be a movieclip with 2 frames showing a play and pause graphic.

Code
if (IsPlayMode()) {
	MovieClip(root).gotoAndPlay(MovieClip(root).currentFrame);
}
else {
	MovieClip(root).gotoAndStop(MovieClip(root).currentFrame);
}


The Captian
Today they call you "crazy". Tomorrow they call you "ahead of your time."
Global Skywatch Learn about Chemtrails - You're breathing them now!
OnlyTheBestHerbs.com World-class supplements
Mercury Talk Why you are sick.
OneUp Domains Domains, Hosting, Email
1-800-358-4278 (U.S. & Canada)