Testing if the mouse clicked on ME (button)?!

Ken Ray kray at sonsothunder.com
Sat Aug 9 14:20:44 EDT 2008


> But it's simple right? *blush*

Yup (BTW, I'm assuming it should count as being stopped after the 60 seconds
are up):

local sStartTime

on mouseUp
  if the label of me is "Start" then
    set the label of me to "Stop"
    put the seconds into sStartTime
    send "CheckTimer" to me in 0 milliseconds   -- allows script to continue
  else
    CancelPending "CheckTimer"
    set the label of me to "Start"
  end if
end mouseUp

on CheckTimer
  put (the seconds - sStartTime) into fld "Counter Show"
  if (the seconds - sStartTime = 60) then
    set the label of me to "Start"
    answer "Time's up!"
  else
    send "CheckTimer" to me in 1 second
  end if
end CheckTimer

on CancelPending pMsg
  put the pendingMessages into tPending
  filter tPending with "*," & pMsg & ",*"
  repeat for each line tMsg in tPending  -- just in case there's more than 1
    cancel item 1 of tMsg
  end repeat
end CancelPending

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