Good morning everyone !,
I have in my scene:show a hand full of functions that are running a digital clock i built using below code. The function startClock(event) self explanatory. Each of those other functions below code in orange run a digit on my timer. However when I leave the scene and goto main menu and come back the timer is still running. I tried
addSecondsDigit:destroy() but get errors
addSecondsDigit:remove() but get errors
can someone show me how to stop the function actions and restart when I return to the scene.
Any Help is much appreciated.
JZ
function startClock( event )
addSecondsDigit()
addDots()
addTensSec()
addMin()
tmrTwo = timer.performWithDelay (600000,addTenMin)
end
tmr = timer.performWithDelay (1000,startClock)
local function addSecondsDigit( event )
local secondsData = {
width = 42,
height = 102,
numFrames = 10,
sheetContentWidth = 211,
sheetContentHeight = 204
}
local secondsClockSheet = graphics.newImageSheet( “clockBr.png”,secondsData)
local secondsSequence = {
{name = “normalRun”,frames = {10,1,2,3,4,5,6,7,8,9},time = 10000}
– {name = “fastRun”,start = 0,count = 10,time = 100}
}
local secondsDigit = display.newSprite(secondsClockSheet,secondsSequence)
secondsDigit.x = 264
secondsDigit.y = screenH / 2 - 160
secondsDigit:setSequence (“normalRun”)
secondsDigit.id = “Second”
secondsDigit:play()
sceneGroup:insert (secondsDigit)
end