# setInterval Frustrations

**URL:** https://forum.kirupa.com/t/setinterval-frustrations/29655
**Category:** flash
**Created:** [August 29, 2003, 1:39am UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655 "2003-08-29T01:39:05Z")
**Posts on this page:** 13
**Page:** 1

<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 29, 2003, 1:39am UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/1 "2003-08-29T01:39:05Z")

</div>

I can’t find the reason why this doesn’t work:

function loadDelay() {  
\_root.Menu.loadMovie(“02.swf”, “\_root.Menu”);  
}  
blah = setInterval(loadDelay, 6000);  
clearInterval(blah);

I have a button, what it should do is wait 6 seconds, then load the movie ‘02.swf’ into the empty MC ‘Menu’.

Now I’ve tried this as well:

setInterval(\_root.Menu.loadMovie, 6000, “02.swf”);

This one loads the movie appropriately, but not into the empty MC. I cannot figure out how to tell it to load into ‘\_root.Menu’ and not just the root.

I think I’m just getting the syntax wrong or something, any help would be appreciated. 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 29, 2003, 2:25am UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/2 "2003-08-29T02:25:42Z")

</div>

try this:

```auto
function loadDelay() {
_root.Menu.loadMovie("02.swf", "_root.Menu");
clearInterval(blah);
}
blah = setInterval("loadDelay", 6000);

```

---

<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 29, 2003, 3:11am UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/3 "2003-08-29T03:11:44Z")

</div>

Although the code posted by lorcas code should work, the correct sintax for the second method you tried, Rojo, is:  
[AS]setInterval(\_root.Menu, “loadMovie”, 6000, “02.swf”);[/AS]  
Be careful though, the movie will reload every 6 seconds since the interval is never cleared.

---

<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 29, 2003, 4:26am UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/4 "2003-08-29T04:26:03Z")

</div>

Thank you both. I’m still having a bit of trouble though, if you don’t mind helping me further…

Lorcas, I put in your code and it did not work unfortunately. It seems like everything is all right there in the right places, but the movie won’t load.

Kode, that works great, but yes it keeps reloading. I tried to do the obvious:

blah = setInterval(\_root.Menu, “loadMovie”, 6000, “02.swf”);  
clearInterval(blah);

It didn’t work, how can I tell this to clearInterval? Or does the first code format only allow for clearInterval?

So close… ugh

---

<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 29, 2003, 4:38am UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/5 "2003-08-29T04:38:42Z")

</div>

Oops! I didn’t see those errors in the code!  
[AS]function loadDelay() {  
\_root.Menu.loadMovie(“02.swf”);  
clearInterval(blah);  
}  
blah = setInterval(loadDelay, 6000);[/AS]  
…Sorry, I should have read carefully. ☹

---

<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 29, 2003, 5:56am UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/6 "2003-08-29T05:56:59Z")

</div>

\*\*\*\*… it still doesn’t work. I think there is a problem somewhere else, it is the only explanation.

Thanks for the help again.

---

<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 29, 2003, 6:04am UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/7 "2003-08-29T06:04:13Z")

</div>

Uhmm… make sure that you’ve assigned the instance name to the MovieClip and the path is correct. :-\

---

<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 29, 2003, 7:56am UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/8 "2003-08-29T07:56:24Z")

</div>

I just don’t get it. This code works perfect, except for the fact that it keeps repeating:

setInterval(\_root.Menu, “loadMovie”, 6000, “02.swf”);

So if that works it means the names and paths are correct… :-\ Should I just upload the file?

---

<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 29, 2003, 3:05pm UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/9 "2003-08-29T15:05:54Z")

</div>

> _Originally posted by Rojo_  
> **So if that works it means the names and paths are correct…**

…So true. 😛

And yes, upload the 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 29, 2003, 4:05pm UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/10 "2003-08-29T16:05:02Z")

</div>

[http://www.timdeneau.com/kirupa.zip](http://www.timdeneau.com/kirupa.zip)

I renamed the empty MC from ‘Menu’ to ‘Character’ because I forgot something else was named ‘Menu’ too! That wasn’t the problem though, but I renamed it anyway to avoid further headaches.

---

<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 29, 2003, 4:37pm UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/11 "2003-08-29T16:37:14Z")

</div>

Well, I changed the named function to an anonymous function and it worked right away. :-  
[AS]loadDelay = function () {  
\_root.Character.loadMovie(“00.swf”);  
clearInterval(blah);  
};  
blah = setInterval(loadDelay, 6000);[/AS]  
I don’t know what’s the problem with the named function, 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: [August 29, 2003, 4:54pm UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/12 "2003-08-29T16:54:58Z")

</div>

Yeah, hmm, I don’t understand how that works and the other doesn’t. But hey at least it works now.

Thank you for all your help, kode. :beam:

---

<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 29, 2003, 4:57pm UTC](https://forum.kirupa.com/t/setinterval-frustrations/29655/13 "2003-08-29T16:57:53Z")

</div>

No problem, I guess… I don’t like these moments when the problem is solved but I have no idea why. :-\
