Time Counter

Signe Marie Sanne Signe.Sanne at roman.uib.no
Tue Feb 22 07:34:40 EST 2005

Malte Brill skrev:

I found it, Malte. I had placed the handler on the card, whereas the mouseUp 
was in
a button script.
I then moved the handler into the button script, and then it's OK. Thanks 
for your
comments anyhow.
Signe Marie

> on mouseUp
>    --we need to call the startMyTimer handler fom somewhere
>    --this could also be on openCard or openStack
>    set the istimer of me to 0
>    --reset the timer
>    if the flag of me is empty then set the flag of me to -1
>    --initialize a flag custom property
>    --Using this cProp we can check if the timer is already running...
>    set the flag of me to the flag of me*-1
>    --change the flag if you click
>    --possible values are -1 and 1
>   --the first time you click it will set the cProp to 1
>    if the flag of me=1 then startMyTimer
>   --if the cProp is 1 then call the timer the first time
> end mouseUp
> on startMyTimer
>    set the isTimer of me to the isTimer of me+1
>    --increase the value of the timer. It will only count
>    put the isTimer of me div 60 into myMinutes
>    --calculate the number of whole minutes
>    if myMinutes<10 then put "0"&myMinutes into myMinutes
>    --if it is smaller than 10 then add an additional zero before it
>    put the isTimer of me mod 60 into mySeconds
>   --what´s left ofer when dividing by 60 is the seconds
>    if mySeconds<10 then put "0"&mySeconds into mySeconds
>   --add additional zero if necessary
>    put myminutes&":"&myseconds
>   --put minutes:seconds into msg
>    if the flag of me=1 then send startMyTimer to me in 1 second
>   --if the flag cProp of the calling object is 1 then call the 
> startMyTimer handler again
>   --so if you click the button holding the script again the flag will be 
> set to -1
>   --and the handler wont be called anymore
> end startMyTimer
> Hope this helps.
> Malte
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution

More information about the Use-livecode mailing list