# Using GetTimer to pause a movie problem

**URL:** <https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803>\
**Category:** flash\
**Created:** [August 31, 2003, 2:44am UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803 "2003-08-31T02:44:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bonafide](https://avatars.discourse-cdn.com/v4/letter/b/54ee81/32.png) [@bonafide](https://forum.kirupa.com/u/bonafide)\
**Post date:** [August 31, 2003, 2:44am UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803/1 "2003-08-31T02:44:54Z")

</div>

I am working on a project, and I am trying to incorporate the get timer to pause a movie tutorial. I have a main movie and my second movie(2nd movie) that is being placed on the main stage. In my second movie I have two other movies with the get timer tutorial being implemented to pause those two movies. The problem that I am having is that my movies don’t seem to pause, and for some reason I am having a difficult time lining up my two movies. They are supposed to play one after the other and in place of the first, once the pause has lapsed. I am providing the .fla I hope I haven’t confused anyone. Any help would be appreciated.

Thanks in Advance  
Bonafide

---

<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:** [August 31, 2003, 2:53am UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803/2 "2003-08-31T02:53:28Z")

</div>

I think you forgot to either attach the FLA, or post the link to it… 😛

---

<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:** [August 31, 2003, 2:59am UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803/3 "2003-08-31T02:59:54Z")

</div>

Sorry, here is the link

[http://www.flexfinity.com/pause/pausemovieprob.fla](http://www.flexfinity.com/pause/pausemovieprob.fla)

---

<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:** [August 31, 2003, 3:19am UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803/4 "2003-08-31T03:19:35Z")

</div>

Ok… what’s supposed to happen in the movie? vogue1 plays, pause, vogue2 plays, pause, main timeline plays? :-\

---

<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:** [August 31, 2003, 3:26am UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803/5 "2003-08-31T03:26:05Z")

</div>

yeah vogue 1 plays, pause then vogue 2. The reason there is a main timeline is because in the actual movie that I am working on those movies (vogue1 and vogue 2) will be sitting in another movie (one that contains the two(both vogues)) with the pause that will be place on the main time line

---

<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:** [August 31, 2003, 4:49am UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803/6 "2003-08-31T04:49:56Z")

</div>

Uhmm… like this? [EDIT]File no longer available[/EDIT].

In case I misunderstood, the code should give you a better idea at least.

**PS.** Please let me know as soon as you get the file, I have to delete it shortly. Thank you.

---

<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:** [August 31, 2003, 5:21am UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803/7 "2003-08-31T05:21:52Z")

</div>

Kode, thanks. That is the effect I want. Now I have to try and understand the code. Thanks for getting me on my way.

Bonafide

---

<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:** [August 31, 2003, 5:27am UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803/8 "2003-08-31T05:27:58Z")

</div>

You’re welcome, bonafide. 😉

And well, I don’t remember the code I used and I already deleted the files. 😛  
Post it here and I’ll try to explain it to you. 🙂

---

<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:** [August 31, 2003, 6:03am UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803/9 "2003-08-31T06:03:30Z")

</div>

Code:  
[AS]var timer;  
var pause = 1000;  
this.onEnterFrame = function() {  
if (vogue1.\_currentframe == vogue1.\_totalframes) {  
if (!timer) timer = getTimer();  
if (getTimer()-timer\>=pause) {  
this.nextFrame();  
}  
}  
};  
this.stop();[/AS]

---

<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:** [August 31, 2003, 5:29pm UTC](https://forum.kirupa.com/t/using-gettimer-to-pause-a-movie-problem/29803/10 "2003-08-31T17:29:51Z")

</div>

In the first two lines of the code the variables are defined. No problems here, right?  
[AS]this.onEnterFrame = function() {[/AS]  
This line defines the function that will be executed in the onEnterFrame handler.

onEnterFrame handler: [http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary546.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary546.html).  
[AS]if (vogue1.\_currentframe == vogue1.\_totalframes) {[/AS]  
Checks if the current frame of the MovieClip instance, vogue1, equals its total frames. Which would mean the animation has finished.

\_currentframe property: [http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary514.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary514.html).  
\_totalframes property: [http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary576.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary576.html).  
[AS]if (!timer) timer = getTimer();[/AS]  
If the variable timer is not defined yet, sets the variable equal to the time (milliseconds) elapsed since the movie started.

getTimer function: [http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary376.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary376.html).  
[AS]if (getTimer()-timer\>=pause) {[/AS]  
Checks if the difference between the milliseconds returned by getTimer and the milliseconds when the animation finished, is greater than or equal to the pause value.  
[AS]this.nextFrame();[/AS]  
Sends the playhead to the next frame of the MovieClip.

nextFrame method: [http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary542.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary542.html).  
[AS]this.stop();[/AS]  
Stops the MovieClip.

stop method: [http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary569.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary569.html).

…The end. 😛
