"Rolling Credits" - Stop them and start them again
Ken Ray
kray at sonsothunder.com
Sat Mar 5 15:20:35 EST 2005
On 3/5/05 8:33 AM, "Alan Gayne" <alanira9 at mac.com> wrote:
> local maxScroll
> constant scrollIncrement = 1
> constant frameTime = 25
>
> on startRolling -- begin rolling credits
> put the formattedHeight of me - the height of me \
> - the topMargin of me - the bottomMargin of me \
> into maxScroll -- the most this field can scroll
> send "rollCredits" to me -- triggers the first frame
> end startRolling
>
> on rollCredits -- rolls the next bit
> set the vScroll of me to (the scroll of me + scrollIncrement)
> if the vScroll of me < maxScroll then
> -- trigger the next frame:
> send "rollCredits" to me in frameTime milliseconds
> else -- we're done:
> wait for 2 seconds -- to let the user read the last part
> hide me with visual effect dissolve
> set the vScroll of me to zero
> show me with visual effect dissolve
> end if
> end rollCredits
Alan,
Try this... is used my "CancelPending" handler to cancel a pending message.
Simply click on the field to pause/unpause:
local maxScroll
constant scrollIncrement = 1
constant frameTime = 25
local sPaused
on startRolling -- begin rolling credits
put the formattedHeight of me - the height of me \
- the topMargin of me - the bottomMargin of me \
into maxScroll -- the most this field can scroll
put false into sPaused
send "rollCredits" to me -- triggers the first frame
end startRolling
on rollCredits -- rolls the next bit
set the vScroll of me to (the scroll of me + scrollIncrement)
if the vScroll of me < maxScroll then
-- trigger the next frame:
send "rollCredits" to me in frameTime milliseconds
else -- we're done:
wait for 2 seconds -- to let the user read the last part
hide me with visual effect dissolve
set the vScroll of me to zero
show me with visual effect dissolve
end if
end rollCredits
on mouseUp
PauseResume
end mouseUp
on PauseResume
if sPaused then
send "rollCredits" to me
else
CancelPending "rollCredits"
end if
put not(sPaused) into sPaused
end PauseResume
on CancelPending pWhat
if pWhat = "" then put "all" into pWhat
switch pWhat
case "all"
repeat with x = (the number of lines of the pendingmessages) down to 1
cancel (item 1 of line x of the pendingMessages)
end repeat
break
default
repeat with x = (the number of lines of the pendingmessages) down to 1
if line x of the pendingMessages contains ("," & pWhat & ",") then
cancel (item 1 of line x of the pendingMessages)
end if
end repeat
break
end switch
end CancelPending
HTH,
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list