ClearInterval that was set inside a movieclip?
I have a movieclip where I have lots of code, because its kind of a module. Inside it have have some AS2 code inside a movieclip called "mymodule"
Code:
var myinterval;
some_movieclip.onRelease = function(){
clearInterval(myinterval);
myinterval = setInterval(myfunction, 200);
};
However, when I go to another "section" in my Flash, I need to make sure all intervals are cleared, because a user could easily click on another section while something is running and it needs to clear them.
But I cant figure out how to kill intervals I have set.
The following doesn't work of course
Code:
mymodule.clearInterval(myinterval);
And this dont work either
Code:
clearInterval(mymodule["myinterval"]);
Any ideas? :confused: Thanks in advance
interval not clearing up..
I have definite set of 5functions namely rb1(),rb2(),rb3(),rb4() and rb5().
Each has to be played one after another in a sequence after 5,10,15,20,30s such they seems like movie.
I call them via setInterval() in a loop.
for (m=0; m<6; m++)
{
set("_root.id"+(m), (setInterval(eval("_root.play"+(m)), timep)));
var container:Number=timeMonitor(m);
timep = timep+container;
}
where by timeMonitor() I take different value of time.
function timeMonitor(step):Number
{
if(step==1)
{
time=5000;
}
else if(step==2)
{
time=10000;
}
else if(step==3)
{
time=15000;
}
else if(step==4)
{
time=20000;
}
else if(step==5)
{
time=30000;
}
return time;
}
I have also cleared up Interval in each rb1(),rb2(),rb3(),rb4() and rb5(). as clearInterval(_root.id1);clearInterval(_root.id2) etc
When I execute my code, then for first time it execute as desired. Then for second round as game refreshes by function which I defined then it execute abnormally seems chaos and repitation.All id are also initialize in beginning.
Any help how it can be corrected ???
Thanks.