Any time
Hi,
Could please take a look at this code? Iâm getting:Â attempt to call method âremoveSelfâ (a nil value). Whatâs wrong?
The ideia is to cancel/remove timers when going to other scenesâŚ
function scene:enterScene( event ) local function message( ) print( "timer1" ) end self.timer1 = timer.performWithDelay( 5000, message ) storyboard.gotoScene( "otherScene", { time = 500, effect = "crossFade" } ) end function scene:exitScene( event ) self.timer1:cancel( ) self.timer1:removeSelf( ) end
I think you should just do Timer.cancle(your timer id ) and then I believe that you could set it to nil
Sean:
From Boxing Studio Games
I would just do Timer.cancle (your id)
For example Timer.cancle ( timer1)
Your error mean your disposing something that doesnât exist
Sean:
from Boxing Studio Games
Timers do not support a removeSelf() method. After you cancel it, you can simply nil it.
Rob
Of course! Thank you again Rob and Sean
anytimeÂ
Sean:
From Boxing Studio Games Â