Cleaning Timers? Plz Help

Ricardo,

What do you mean when you state we must clean our own Timers? I am a bit lost about this because that is the biggest part of the code that has changed over the course of the revisions to the Director Class.

I have just created the following code with the timer at the end. Is this the kind of timer you are talking about and if so how are we supposed to clean it?

Would you mind giving a bit more details on how we clean timers and runtime events.

Thanks
Rob

BTW: Thanks for Director Class and the new update.
It is an awesome tool!!!

[code]local touchObject1 = function (event)
if event.phase == “ended” then
local chalkbdImage = display.newImageRect( “zImages/chalkbd.png”, 825, 568 )
chalkbdImage.x = 512; chalkbdImage.y = 384
localGroup:insert(chalkbdImage)
audio.play( slideSound )

local removechalkbd = function()
chalkbdImage:removeSelf()
end

timer.performWithDelay(5000, removechalkbd)

end
end

textObject1:addEventListener(“touch”, touchObject1) [import]uid: 16527 topic_id: 6750 reply_id: 306750[/import]

he means if you have various timers still running when you call the director scene change, you need to cancel those timers before actually calling the change. Director won’t do it for you.

let’s say you set something to happen in 10 seconds, but you trigger a scene change for another reason after only 5 seconds. you dont want that initial timer triggering 5 seconds later if it was doing something to scene1, because scene1 wont exist any more [import]uid: 6645 topic_id: 6750 reply_id: 23645[/import]

jmp909

Thanks for the info that make sense; oddly soon after you posted i ran into the issue you described.

Now aside from not triggering the change scene before the 10 seconds is up. Would you mind explaining how you clean the timer when the scene changes.

Thanks for you help.
[import]uid: 16527 topic_id: 6750 reply_id: 23736[/import]