On 16 Jan 2006, at 23:02, Ben Bock wrote:

I have a timed quiz spread across several cards, each card has a "Next Page" button. The quiz starts with a button.

To start the quiz, a button has:

on mouseUp
startTimer
go next
end mouseUp


The card script has:


on startTimer
    send timesUp to me in 120 seconds
end startTimer

on timesUp
    go card "Finish Card"
end timesUp


It's probably better to place these handlers in the stack script. (see below)

Here are two possible approaches:

1.

In the stack script:
---------------------------------------
local sTimerOn

on startTimer
    put true into sTimerOn
    send timesUp to me in 120 seconds
end startTimer

on timesUp
  if sTimerOn then
    go card "Finish Card"
  end if
end timesUp

on NeverMind
  put false into sTimerOn
end NeverMind
----------------------------------

2.

In the stack script:
---------------------------------------
local sTimerID

on startTimer
    send timesUp to me in 120 seconds
    put the result into sTimerID
end startTimer

on timesUp
    go card "Finish Card"

end timesUp

on NeverMind
 cancel sTimerID
end NeverMind
----------------------------------

In both cases, the two mouseUp handlers you currently have should work fine.

Note that it's important that the "script local" variables (sTimerID or sTimerOn) are declared outside the handlers. In this way they can be be shared by all the handlers in the stack script.

Cheers
Dave
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to