Countdown HH:MM:SS
Ken Ray
kray at sonsothunder.com
Wed Jul 20 13:06:05 EDT 2011
> Using the dateItems is definitely the right direction, but my objective is
> to count backwards from for example; 2 hours, 45 minutes, and 59 seconds
> while updating the display field every second. When the countdown reaches
> 00:00:00, I would play a sound of do other actions.
Sorry about that... this will work if you just want to count down from a fixed amount of time:
on mouseUp
DoCountDown "2:45:59"
end mouseUp
on DoCountDown pTime
convert pTime to seconds
subtract 1 from pTime
convert pTime to dateItems
split pTime by ","
put format("%02d:%02d:%02d",pTime[4],pTime[5],pTime[6]) into tNewTime
put tNewTime into fld "Time"
if tNewTime = "00:00:00" then
TimesUp
else
send "DoCountDown tNewTime" to me in 1 second
end if
end DoCountDown
on TimesUp
answer "Done"
end TimesUp
Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/
More information about the use-livecode
mailing list