question about a timer
Posted: Thu Jan 19, 2012 5:48 pm
Hello everyone....I was hoping I could get some help on a timer I have modified. I found some info about creating a timer and I added a few things to make it useful for my program, but I have a question about the counting process. I will attach the code and explain...
When the seconds tick up to 60, the counter resets and goes back to zero....but instead of looking like "00" , it looks like "0" then proceeds to count up by 1. I would like the numbers to be able to count up in increments of (01,02,03,etc), so that it looks more like a clock. Any suggestions?
Code: Select all
on mouseUp
if the label of me = "start" then
set the label of me to "stop"
set the startingTime of me to the seconds
set the oldTime of me to line 1 of fld "timer"
send "countUp" to me in 1
else
set the label of me to "start"
end if
end mouseUp
on countUp
put (the seconds - the startingTime of me) + the oldTime of me into fld "timer"
if the label of btn "start" = "stop" then send "countUp" to me in 1
if fld "timer" >=60 then
put "00" into fld "timer"
add "1" to fld "minute"
set the startingTime of me to the seconds
set the oldTime of me to line 1 of fld "timer"
send "countUp" to me in 1
else
end if
end countUp
When the seconds tick up to 60, the counter resets and goes back to zero....but instead of looking like "00" , it looks like "0" then proceeds to count up by 1. I would like the numbers to be able to count up in increments of (01,02,03,etc), so that it looks more like a clock. Any suggestions?