"Rolling Credits" - Stop them and start them again

Dick Kriesel dick.kriesel at mail.com
Sat Mar 5 23:20:22 EST 2005


On 3/5/05 3:51 PM, "Alan Gayne" <alanira9 at mac.com> wrote:

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

The first click would have no effect because variable "sPaused" hasn't been
initialized as "false."

The text would not scroll further because handler "rollCredits" never sends
"rollCredits," because variable "maxscroll" hasn't been initialized, because
nothing executed "startRolling."

On 3/5/05 12:20 PM, "Ken Ray" <kray at sonsothunder.com> wrote:

> 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

There's a way to do that a little simpler and faster.  It's simpler because
it has no switch. It's faster because it invokes "filter" instead of testing
each line within a loop.

on cancelPendingMessages pMessageName
  -- note: empty implies cancel all pending messages
  put the pendingMessages into tPendingMessages
  if pMessageName is not empty then
    filter tPendingMessages with "*," & pMessageName & ",*"
  end if
  repeat for each line tPendingPessage in tPendingMessages
    cancel item 1 of tPendingPessage
  end repeat
end cancelPendingMessages

I hope this helps, without offending Ken.

-- Dick




More information about the use-livecode mailing list