"Rolling Credits" - Stop them and start them again

Alan Gayne alanira9 at mac.com
Sat Mar 5 18:51:42 EST 2005


on 3/5/2005 Ken Ray wrote:

> 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
>

Ken,

Thanks for the quick response.

Unfortunately, when I pasted the script into my field, it does not seem 
to work.

first click - nothing.  second click, text scrolls about 1 pixel, then 
nothing.

Overall results, similar to the stuff I wrote.

However, since mine did not use the "pendingMessages" function, I 
suspect you might be on the right track.

Did you actually test it?  Is it possible that some differing stack or 
field property on my side affects this script?

Kind regards,
Alan



More information about the use-livecode mailing list