# \_global setInterval

**URL:** <https://forum.kirupa.com/t/-global-setinterval/30002>\
**Category:** flash\
**Created:** [September 2, 2003, 8:59pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002 "2003-09-02T20:59:09Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![earph](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/earph/32/79_2.png) [@earph](https://forum.kirupa.com/u/earph)\
**Post date:** [September 2, 2003, 8:59pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/1 "2003-09-02T20:59:09Z")

</div>

I have my setInterval that is set this way:

```auto
pause = function () {
play();
clearInterval(stall);
}

stall = setInterval(pause, 1000);

```

I was wondering how I might change this to a “local” function instead of “\_global”. I’ve been trying, but my syntax is either screwed up or just just plain doesn’t work.

Any suggestions?

Thanks ahead of time!

---

<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 2, 2003, 9:02pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/2 "2003-09-02T21:02:39Z")

</div>

[AS]  
MovieClip.prototype.pause = function() {  
this.play()  
clearInterval(stall);  
}

stall = setInterval(pause, 1000);  
[/AS]

I think

---

<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 2, 2003, 9:15pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/3 "2003-09-02T21:15:25Z")

</div>

Nope… no dice. That’s not working either.

Maybe my problem lies elsewhere.

---

<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 2, 2003, 9:23pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/4 "2003-09-02T21:23:17Z")

</div>

post a fla if you can

---

<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 2, 2003, 9:39pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/5 "2003-09-02T21:39:50Z")

</div>

can’t use ‘pause’ as a function name

---

<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 2, 2003, 9:42pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/6 "2003-09-02T21:42:17Z")

</div>

why not? Taken by flash already? On a similar note, does Flash MX support overloading of preexisting functions or user written functions?

---

<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 2, 2003, 9:43pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/7 "2003-09-02T21:43:19Z")

</div>

Alright… do this… Only use the “Getting Started” and “Computer Setup” buttons. Click “Getting Started” when the project opens… after that let it run. You’ll notice that the loaded movie will stop at a sub-menu.

It works alright… But…

Goto the menu and hit the “Get Started” or “Computer Setup” buttons… and alternate as you wish.

Let the movie run again… you’ll notice that all the “setIntervals” won’t catch, and the movie totally ignores the stop at the end of the timeline.

I noticed that it only does it when I hit the buttons when the loaded movie is in the middle of a tween.

Take a look… I appreciate it.

[http://www.expresiv.com/temp/NewPartnerTraining.zip](http://www.expresiv.com/temp/NewPartnerTraining.zip)

---

<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 2, 2003, 9:49pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/8 "2003-09-02T21:49:15Z")

</div>

I looked in the index of “The Definitive Guide” and I didn’t see anything about flash using “pause” for any syntax… so, it should work fine. I’ve never had a problem with this script until I started loading the movie into other movies…

I have no idea about “overloading” or “user written” functions…

---

<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 2, 2003, 9:58pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/9 "2003-09-02T21:58:25Z")

</div>

grandsp5: No Flash does not support overloading… unfortunately

mlkdesign: you CAN use pause, but it is not very good coding practice to use predefined actionscript features as variable or function names.

skillet: pause is a Sound Object feature. I will check out your .fla in a little bit and see if I can see what is up.

---

<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 2, 2003, 10:03pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/10 "2003-09-02T22:03:04Z")

</div>

Oh man… I’m so glad you said that… cause I’m going to have to add audio later on… and that would have really messed my stuff up.

---

<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 2, 2003, 10:07pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/11 "2003-09-02T22:07:06Z")

</div>

lost,  
can you explain a little more about the pause feature for the sound object? I can’t find it in the AS dictionary. Is there a built in pause function for the sound object? That would mean I don’t have to build pause buttons anymore which would be nice.

---

<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 2, 2003, 10:14pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/12 "2003-09-02T22:14:07Z")

</div>

No No… I’m going to add audio later… has nothing to do with this right now.

See my post where I attached the files… that will explain what is happening. If you still don’t understand what I mean, let me know and I’ll try to communicate it in a different way.

---

<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 2, 2003, 10:15pm UTC](https://forum.kirupa.com/t/-global-setinterval/30002/13 "2003-09-02T22:15:03Z")

</div>

Wait i’m sorry, pause is NOT a Sound Object thing. It is an undocumented NetStream Object feature.

NetStream Object: [http://chattyfig.figleaf.com/flashcoders-wiki/index.php?NetStream](http://chattyfig.figleaf.com/flashcoders-wiki/index.php?NetStream)

[edit]skillet: i am not entirely sure I understand what the problem is 😊 [/edit]

---

<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 3, 2003, 2:26am UTC](https://forum.kirupa.com/t/-global-setinterval/30002/14 "2003-09-03T02:26:54Z")

</div>

Problem is… the pause function works fine as long as I hit the \_root buttons when the loaded movie (the paused one) is either paused in a frame or stopped.

If I happen to hit the button while the loaded movie (paused movie) is in the middle of a tween, is totally cancels out the “pause function” and totally ignores my “stop();” at the end of the “loaded movie”

Understand what I’m saying? Hope that makes sense.

So… take the movies I sent you… use the “NewPartner” movie as the \_root.

1. Open the project… press the “Getting Started” button.

2. Let the movie play until you see another “sub-menu” appear and stop.

3. After that, press the “Getting Started” and “Computer Setup” buttons a bunch of times…

You’ll notice after that the movie will no longer hold it’s “pause functions” nor will it stop when the “sub-menu” appears.

Really, Really Weird…

Thanks for all the assistance…!
