Be a Supporter!

I can't clear my interval!

  • 188 Views
  • 1 Reply
New Topic Respond to this Topic
GristlyBear
GristlyBear
  • Member since: Jul. 30, 2011
  • Offline.
Forum Stats
Member
Level 24
Animator
I can't clear my interval! May. 24th, 2012 @ 06:23 PM Reply

So I have the following code more or less at the beginning of a frame:

var myTimer =setInterval (doThing,1000);

and within the doThing function, I have the following code:

if (stats[7]==0){
		clearInterval(myTimer);
		gotoAndPlay(71);
	}

And I know that stats[7] gets to zero, because it does take the user to frame 71. However, in the outputs panel (after reaching frame 71), it keeps saying something about error 1009, null, and doThing. From there I intend for the user to eventually go back to the original frame, which should start the interval again.

Now is there something I'm doing wrong, and if so, how should I fix it? Somewhat more importantly, if I let it continue running and creating errors in the background (it doesn't actually affect anything, as far as I can tell), will it cause flash to go through extreme lag after an extended period of time?


BBS Signature
GristlyBear
GristlyBear
  • Member since: Jul. 30, 2011
  • Offline.
Forum Stats
Member
Level 24
Animator
Response to I can't clear my interval! May. 24th, 2012 @ 06:40 PM Reply

Right, I think I figured it out. At some point while aimlessly trying to find a fix, I made an interval a few frames back that was triggering the errors.

Derp.


BBS Signature