Code: Select all
local sMessageID ## stores the message ID so we can stop the background changing
on openCard
## executed every time we go to a new card
## the slideshow begins when openCard is executed
## delay 2 seconds, then go to the next card
send "showNextSlide" to me in 2 seconds
## store the ID of the delayed message you just sent, so
## you can cancel it if the user clicks pause
put the result into sMessageID
end openCard
on closeStack
quitMyProject
end closeStack
on mouseUp
## when the user clicks
if "showNextSlide" is among the items of the pendingMessages then
## stop the slideshow
cancel sMessageID
else
## restart the slideshow
showNextSlide
end if
end mouseUp
on showNextSlide
visual effect "dissolve fast"
go next card
## which will trigger the openCard handler
end showNextSlide
command quitMyProject
cancel sMessageID
lock messages
-- stop using stacks
put the stacksInUse into myStacks
repeat for each line myStack in myStacks
stop using stack myStack
end repeat
-- stacks
put the openStacks into myStacks
put "message box,home,tool,Message Box,revTools,revMenubar" & comma & the short name of me into myDontClose
repeat for each line myStack in myStacks
if myStack is not among the items of myDontClose then close stack myStack
end repeat
-- messages
put the pendingmessages into myMsgs
repeat for each line myMsg in myMsgs
cancel item 1 of myMsg
end repeat
close me
if the environment is not "development" then
quit
end if
end quitMyProject