# clearInterval

**URL:** <https://forum.kirupa.com/t/clearinterval/65164>\
**Category:** Uncategorized\
**Created:** [September 23, 2004, 3:03pm UTC](https://forum.kirupa.com/t/clearinterval/65164 "2004-09-23T15:03:05Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![gerartje](https://avatars.discourse-cdn.com/v4/letter/g/e19adc/32.png) [@gerartje](https://forum.kirupa.com/u/gerartje)\
**Post date:** [September 23, 2004, 3:03pm UTC](https://forum.kirupa.com/t/clearinterval/65164/1 "2004-09-23T15:03:05Z")

</div>

i made a news ticker…  
every 8 seconds it shows a different item

When I click a button and load another movie, and return…  
the delay between the newsitems is not 8 sec anymore.

When I do the same, it’s even faster.

clearInterval(newTickerId);  
newTickerId = setInterval(myHome.newsTicker,3000);

grtz

---

<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 23, 2004, 3:13pm UTC](https://forum.kirupa.com/t/clearinterval/65164/2 "2004-09-23T15:13:42Z")

</div>

can you give more code, or just 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:** [September 23, 2004, 5:39pm UTC](https://forum.kirupa.com/t/clearinterval/65164/3 "2004-09-23T17:39:41Z")

</div>

Where did you build in the delay of 8 seconds ? The code above just shows the calling of the setInterval, nothing else 🙂

---

<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 24, 2004, 6:23am UTC](https://forum.kirupa.com/t/clearinterval/65164/4 "2004-09-24T06:23:07Z")

</div>

Normally I would post the fla, but it’s a project.

But here’s the code:

```auto
newTickerId = setInterval(myHome.newsTicker,3000);

myHome.newsTicker = function()
{		
		clearInterval(newTickerId);
		maskNieuws_mc._width=2;
		maskNieuws_mc.tween("_width",277,1,"easeInQuart");
		if(teller==0)
		{
			teller=aantalItems;
		}
		teller--;
		var tekst = titelNieuwsArray[teller];
		leesMeer_mc.node=teller;
		tekst +="<br><br>"
		if(introNieuwsArray[teller].length>180)
		{
			tekst+=introNieuwsArray[teller].substring(0,180);
			tekst+="..."
		}else
		{
			tekst += introNieuwsArray[teller];
		}
		
		//news_txt.styleSheet=myCss;
		news_txt.htmlText=tekst;
		news_txt.setTextFormat(homeStijl);
		
		
}

```

Maybe my interval comes in conflict with my tween function (Robert Penner classes)

---

<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 24, 2004, 6:26am UTC](https://forum.kirupa.com/t/clearinterval/65164/5 "2004-09-24T06:26:20Z")

</div>

PS. we kunnen ook altijd verder gaan in het Nederlands hoor… 🙂

---

<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 24, 2004, 6:41am UTC](https://forum.kirupa.com/t/clearinterval/65164/6 "2004-09-24T06:41:20Z")

</div>

i have also placed clearInterval(newTickerId); before my setInterval, but that doesn’t work too…

and I replaced the tween function, with my own onEnterframe function

still the same problem…

my setInterval is not in a loop or something like that… just in a function that is called every time the home.swf starts

grtz

---

<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 24, 2004, 7:44am UTC](https://forum.kirupa.com/t/clearinterval/65164/7 "2004-09-24T07:44:42Z")

</div>

i really don’t understand how your fla is set up…  
je kan me toevoegen op je msn/icq/yahoo/aol nummers staan in m’n profiel en ik ben tot 5 uur bereikbaar.

---

<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 24, 2004, 8:24am UTC](https://forum.kirupa.com/t/clearinterval/65164/8 "2004-09-24T08:24:26Z")

</div>

my site is built up like this…

I have a menu.swf, that automatically loads my home.swf

HOME.SWF

```auto
if(myHome == undefined)
{
  _global.myHome = new Object();
}

myHome.build = function()
{
  ...
 clearInterval(intervalID);
  intervalID = setInterval(myHome.newsTicker,3000);
}

myHome.newsTicker = function()
{
  ....
}

myHome.build();

```

my whole movie is attached to one movie which is on depth 1  
And in menu.swf you can click other items, they will load in a contentHolder\_mc, just like home.swf  
all my code is on one frame  
If i change several times between “home” and “over vdb” my setInterval acts weird.

grtz

grtz

---

<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 24, 2004, 7:30pm UTC](https://forum.kirupa.com/t/clearinterval/65164/9 "2004-09-24T19:30:20Z")

</div>

problem solved…

i had the following:

clearInterval(intervalId);  
intervalId = setInterval(function, interval);

in one swf, but if you go to another swf, and you return, you can’t delete intervalId because it will be undefined.  
So i made a \_global.intervalId
