Simple question needs a simple answer

Something I should really know, but I’ve never had much call for it before…

I’m using storyboard for scene management and the occasional scene uses ‘timer.performWithDelay(1500, function)’

I tend to execute it in the create scene function, rather than the onEnterScene.

Do I have to remove this function (in a similar way to a “enterFrame” runtime event listener)? And if so, how?

Thanks

Mark

Lots of different ways to cancel timers, but another developer had the same exact question as you. Jason Schroeder wrote a timer module that handles this kinda thing and posted it in the forum thread. I blogged about it in the “From the Forum” feature, but here’s the direct link:

http://forums.coronalabs.com/topic/54775-removing-timers-on-scene-change-help-needed-please

FWIW you should switch over to Composer now. It’s relatively pain-free and it’s the supported scene management API.

If you change scenes before the timer fires, then you would need to cancel the timer. If it’s not a repeating timer, you do not have to cancel it if it has already fired.

Rob

Lots of different ways to cancel timers, but another developer had the same exact question as you. Jason Schroeder wrote a timer module that handles this kinda thing and posted it in the forum thread. I blogged about it in the “From the Forum” feature, but here’s the direct link:

http://forums.coronalabs.com/topic/54775-removing-timers-on-scene-change-help-needed-please

FWIW you should switch over to Composer now. It’s relatively pain-free and it’s the supported scene management API.

If you change scenes before the timer fires, then you would need to cancel the timer. If it’s not a repeating timer, you do not have to cancel it if it has already fired.

Rob