I have a movie with the main content loaded on _level1. In this movie I have a function:
[AS]intervalID = setInterval(advPhoto, 2000);[/AS]
when I load a different movie into that level then load the previous one again, the function is still triggered. If I trigger the fuction again it just doubles up and I can only stop the second instance.
I would’ve though that unloading the movie would kill the setInterval on this level.
I have tried to clearInterval(intervalID) when the movie loads.
Well, the code seems to be fine. Which means that (kind of obvious (but I didn’t know!)) the interval is not cleared. Can’t you just clear the interval before you load the new movie?
Try to clear the interval before you call the loadMovie method.
[AS]on (release) {
_level1.clearInterval(intervalID);
loadMovie(“gallery.swf”, 1);
}[/AS]
I’m not sure though… :-\
Ok… I think you zipped the wrong test1.fla and test2.fla files… :crazy:
Anyway, try using this little function, it will clear every interval in the Flash movie.
[AS]_global.clearAllIntervals = function() {
var i = 0, n = setInterval(arguments.callee, 10000);
while (i++<n) clearInterval(i);
};[/AS]
I repeat, it will clear them all.
Just call the function from anywhere in the movie.
[AS]clearAllIntervals();[/AS]
I’m so stupid!!
[AS]on (release) {
clearInterval(_level1.intervalID);
loadMovie(“test2.swf”, 1);
}[/AS]
…This is the second time tonight that I didn’t see the error. :-
I really should go to bed.