Function not removing from storyboard?

local function createFuelCell() local coin = display.newImage("images/game/fuel-cell.png", math.random(20,screenW-20), -25, math.random(8,14), math.random(210,223),7) physics.addBody( coin, "dynamic") coin.myName = "coin" end timer.performWithDelay( 500, createFuelCell, 0)

Hi All,

I have to above function in storyboard and its not removing it’s self and continues to show in all scenes? Any idea why?

You need to manually cancel the timer when you exit the scene

You never insert the coin into the scene’s view group.

Rob

Yeah cancel the timer in your exist function if you want to cancel it when the scene change ie

timer id = Timer.performWithDelay (1000, listener,0)

In exist scene function do this

Timer.cancle (timer id); that’s should do it good luck any question ask me

You need to manually cancel the timer when you exit the scene

You never insert the coin into the scene’s view group.

Rob

Yeah cancel the timer in your exist function if you want to cancel it when the scene change ie

timer id = Timer.performWithDelay (1000, listener,0)

In exist scene function do this

Timer.cancle (timer id); that’s should do it good luck any question ask me