NOTE: you may want to add a startMovie or endMovie handler which clears the actorList.
property pstartMin
property pstartSec
property pCountUp -- time up (1) or count down (0) (default is down)
property pStopTime -- a switch for the timer
property pSecNow
property pMinNow
on beginSprite me
set pStopTime = FALSE
add the actorList, me
if NOT pCountUp then
set pStartMin = pStartMin - 1
set pStartSec = pStartSec + 60
end if
startTimer
end
on stepFrame me
if NOT pStopTime then
if pCountUp then
countUp me
else
countDown me
end if
end if
end
on countUp me
set secondsElapsed = the timer/60
set pSecNow = secondsElapsed mod 60
set pMinNow = the timer/3600
displayTime me
end
on countDown me
set secondsElapsed = the timer/60
set pSecNow = pStartSec - (secondsElapsed mod 60)
set pMinNow = pStartMin - (the timer/3600)
if pSecNow > 60 then
set pMinNow = pMinNow + 1
set pSecNow = pSecNow - 60
end if
displayTime me
if pMinNow = 0 and pSecNow = 0 then
set pStopTime = TRUE
end if
end
on displayTime me
if pSecNow = 60 then
put pMinNow + 1 & ":00" into showTime
else if pSecNow < 10 then
put pMinNow & ":0" & pSecNow into showTime
else
put pMinNow & ":" & pSecNow into showTime
end if
put showTime into field "timer"
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA