Question
Can't stop setInterval with clearInterval
var mySeconds = 5;
this.seconds_txt.text = mySeconds;
var timerId = setInterval(countDown.bind(this), 1000);
function countDown(){
if(mySeconds == 0){
this.myStopIntervalFunction(); //call to function fires but doesn't clear interval
clearInterval(countDown); //doesn't work
}
else{
mySeconds--;
this.seconds_txt.text = mySeconds;
}
}
this.myStopIntervalFunction = function (root) {
console.log("myStopFunction fired");
root.clearInterval(countDown);
};
I have no idea why its not working.
