stopping an on-screen timer
Richard Gaskin
ambassador at fourthworld.com
Thu Jan 19 18:47:25 EST 2006
Peter T. Evensen wrote:
> A button or other user action, i.e., hitting return in a field to enter
> an answer. I just wasn't sure if using a global was the best
> solution.... I tend to dislike using globals.
The only practical downside to globals is that they can be set from
anywhere. With a little care in naming them so they're unlikely to be
confused with anything else there should be no harm.
You could also use a global propery, but the downside there is that it's
persistent, so if you use that you'll want to include a way to reset its
default value in a StripAndShip handler before you build the standalone.
--
Richard Gaskin
Fourth World Media Corporation
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
> At 05:00 PM 1/19/2006, you wrote:
>> What triggers the stop?
>>
>> If it's a button, you could use a global easily enough:
>>
>> on mouseUp
>> global gTimerActive
>> put false into gTimerActive
>> end mouseUp
>>
>> on UpdateTimer
>> global gTimerActive
>> --
>> -- update the display
>> --
>> -- also added a safety check here on the odd chance that
>> -- this routine is called more than once between updates;
>> -- with a one-second interval it's probably not needed,
>> -- but with short intervals it can be handy, and does no
>> -- harm if it's not needed:
>> if gTimerActive is not "false" \
>> AND "UpdateTimer" is not in the pendingMessages then
>> send "UpdateTimer" to me in 1 sec
>> end if
>> end UpdateTimer
More information about the use-livecode
mailing list