Hello everyone,
I am creating a rectangle which should blink for 5 secs and then it should be removed.First to cancel the blinking process after 5 secs I am using timer.performWithDelay() and then as the transition gets cancel I have used onCancel to call a function which removes rectangle.
The problem is transition.cancel() is not getting applied after 5 secs but its getting applied as the program runs.
Following is the code:
local rec1=display.newRect(0,0,display.viewableContentWidth+200,display.viewableContentHeight+200 ) rec1.name="rect1" rec1.anchorX=0 rec1.anchorY=0 function canceltrans(a) transition.cancel(a) end function removerec() rec1:removeSelf( ) end a=transition.blink( rec1, {time=1500, onCancel=removerec() } ) timer.performWithDelay( 5000, canceltrans(a) )
I am not understanding what is going wrong, please see if someone can help.
Thanks and Regards,
Swanand Thakur