I’m using a timer on a keyframe to auto refresh mcs every 10 secs. This is working correctly but when I click on a button from a dynamically loaded mc I want it to stop the function from running.
[AS]
function movieDelay() {
choice = Math.round(Math.random()*2);
switch (choice) {
case 0 :
feature.loadMovie(“movies/featured1.swf”);
break;
case 1 :
feature.loadMovie(“movies/featured2.swf”);
break;
case 2 :
feature.loadMovie(“movies/featured3.swf”);
break;
}
}
setInterval(movieDelay, 10000);
[/AS]
Since the variable count is not used anymore, use a local variable.
[AS]function movieDelay() {
var count = Math.floor(Math.random()*3)+1;
feature.loadMovie(“movies/featured”+count+".swf");
}[/AS]
That way it will be destroyed after the function has been executed.