Time Counter

Malte Brill revolution at derbrill.de
Tue Feb 22 13:04:07 CST 2005


Hi Yves,
same issue. ;-) there is still one startMyTimer message cued in the 
pendingMessages
So instead of waiting for the message to pass we need to  cancel it

Here´s the script... (also added hours)

on mouseUp
     if the flag of me is empty then set the flag of me to -1
     set the flag of me to the flag of me*-1
     repeat with i=1 to the number of lines of the pendingMessages
       if "startMyTimer" is in line i of the pendingMessages then
         cancel item 1 of line i of the pendingMessages
         exit repeat
       end if
     end repeat
     set the isTimer of me to 0
     if the flag of me=1 then
       startMyTimer
     else
       wait 3 seconds with messages
       put "00:00:00" into field "timer"
     end if
end mouseUp

on startMyTimer
     set the isTimer of me to the isTimer of me+1
     put the isTimer of me div 60 into myMinutes
     put myMinutes div 60 into myHours
     put myMinutes mod 60 into myMinutes
     put the isTimer of me mod 60 into mySeconds
     if myHours<10 then put "0"&myHours into myHours
     if myMinutes<10 then put "0"&myMinutes into myMinutes
     if mySeconds<10 then put "0"&mySeconds into mySeconds
     put myHours&":"&myMinutes&":"&mySeconds into fld "timer"
     if the flag of me=1 then send startMyTimer to me in 1 second
end startMyTimer


Cheers,

Malte

 >When I click to STOP, it adds one second and then stops...

 >How can this ?



More information about the use-livecode mailing list