# Pausing an animation

**URL:** <https://forum.kirupa.com/t/pausing-an-animation/64392>\
**Category:** Uncategorized\
**Created:** [September 15, 2004, 7:27pm UTC](https://forum.kirupa.com/t/pausing-an-animation/64392 "2004-09-15T19:27:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![emolen](https://avatars.discourse-cdn.com/v4/letter/e/94ad74/32.png) [@emolen](https://forum.kirupa.com/u/emolen)\
**Post date:** [September 15, 2004, 7:27pm UTC](https://forum.kirupa.com/t/pausing-an-animation/64392/1 "2004-09-15T19:27:20Z")

</div>

I have tried to figure out how to get an animation to pause at a desired frame after a click rather than just stopping it at that exact frame or putting a stop action at the desired frame. My goal is to have a movie sequence play continuesly and when a user so desires he/she can click and stop the movie, but rather than stop it while it is in transition at that exact frame, the movie should continue to a point where it is logical for the movie to stop.(example: the movie is at frame 2 when the user clicks, but instead of stopping at frame 2 it continues to frame 10, and then stops) Then on another click the movie will continue through it’s sequence as it was before. I would like to use a MC, onClipEvent to handle the script in Flash MX. If anyone has any ideas please let me know what they are.  
Thanks, and Cheers  
erok

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 16, 2004, 6:47am UTC](https://forum.kirupa.com/t/pausing-an-animation/64392/2 "2004-09-16T06:47:03Z")

</div>

Button1:

```php

   on (release) {
   	_global.pressed = true
   }
   

```

Frame10:

```php

   if (_global.pressed) {
   	this.stop();
   }
   

```

Button2:

```php

   on (release) {
   	_global.pressed = false;
   	_root.MC.play(); //MC is your movieclip
   }
   

```

That’s one way i can think of…but i’m sure there are many other ways

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 17, 2004, 11:13pm UTC](https://forum.kirupa.com/t/pausing-an-animation/64392/3 "2004-09-17T23:13:43Z")

</div>

sure but I’m not using buttons. onMouseDown, or onClipEvent would be best and then I would need an if then statement, which I can’t figure out but I know is simple. HMMMMM  
thanks though

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2004, 1:00am UTC](https://forum.kirupa.com/t/pausing-an-animation/64392/4 "2004-09-18T01:00:13Z")

</div>

How else is the user going to stop the movie…you said this urself:

> My goal is to have a movie sequence play continuesly and when a user so desires he/she can click and stop the movie…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 18, 2004, 6:24am UTC](https://forum.kirupa.com/t/pausing-an-animation/64392/5 "2004-09-18T06:24:12Z")

</div>

give the movieclip an instance name mc.  
in its first frame type  
if (\_parent.stopped != false) {  
stop();  
} else {  
play();  
}

in any other frames which you think are good stopping points type  
if (\_parent.stopped != false) {  
stop();  
}

on the main timeline  
stopped = true;  
onMouseDown = function () {  
(stopped=!stopped) ? trace(“stopping”) : mc.play();  
};
