Stopping a function mid way

Hey everyone,

I currently have this function in my flash

function wait() {
gotoAndStop(19);
clearInterval(myTimer); .
}
myTimer = setInterval(wait, 6000);

however, sometimes I leave the page before it times out however it will continue to count down and change to that frame regardless of what im doing. Is there anyway to tell the function that if I leave the page its to stop working?

Natushi12

yep - wherever you have the code that tells your movie to go and do something - you need to use:

clearInterval(myTimer);

to stop that interval from progressing.

[quote=creatify;2333460]yep - wherever you have the code that tells your movie to go and do something - you need to use:

clearInterval(myTimer);

to stop that interval from progressing.[/quote]

cool, thanks