clearInterval

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

can you give more code, or just the fla?

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

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

But here’s the code:

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)

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

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

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.

my site is built up like this…

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

HOME.SWF

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

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