problem with callbacks

Toma Tasovac ttasovac at princeton.edu
Tue Oct 7 17:24:01 EDT 2003


(sorry if this is a double post, but the list seems to have been dead 
all day long)

Thanks to Ken and Jan for responding.  For some reason, I couldn't get 
to prevent the callbacks from showing with a simple if clause... I 
started now with a different approach, which works with preventing the 
callbacks from showing if they've already been showed, but lands me in 
trouble with onCurrentTimeChanged

Here's what I've done.  On openStack, I create a global myCallbacks -- 
so that at any time I can have a list of all callbacks available.  My 
callback messages (sentnece 1, sentence 2, sentence 3) do the following:

on sentence x
   lock screen
   set the textColor of item x-1 of fld "Field 1" to black
   set the textColor of item x of fld "Field 1" to blue
   put x into lastPlayed
   unlock screen
  end sentence

Now, since I want to avoid repeated executions when the user stopps the 
movie, I have:

on playPaused
   put the callbacks of player "Player 1" into tempCallbacks
   delete line 1 to lastPlayed - 1 of tempCallbacks
   set the callbacks of player "Player 1" to tempCallbacks
end playPaused

So far so good.  When the user stops the movie and then continues 
playing -- previous callbacks are not sent.  Beautiful.

But then, I want to deal with onCurrentTimeChanged, that is if the user 
scrolls back to the beginning of the movie.  I thought this would be 
simple enough:

on currentTimeChanged
   set the callbacks of player "Player 1" to myCallbacks
end currentTimeChanged

But this DOESN'T work because (as Message Watcher will tell us) when 
the user moves to the beginning of the movie, currentTimeChanged is 
sent, but when the user releases the scroller, another "playPaused" is 
sent, which means I'm stuck again with a truncated version of callbacks 
(from on playPaused handler) and the not the full version that I 
expected from my global variable.

What's the best thing to do now?

Many thanks in advance.
T.

Am Montag, 06.10.03 um 17:46 Uhr schrieb Jan Schenkel:

> Hi Toma,
>
> Off the top of my head, I'd try and save in script
> locals whether or not I had received and reacted to a
> certain callback -- are they all different callback
> handlers or does QT pass a different parameter to the
> same callback handler ?
> Then, if the movie starts (not resumes) you could
> clear these variables. Not sure how to do the above,
> but it seems the best solution at this point.
>
> Hope this helped,
>
> Jan Schenkel.
>
>
> =====
> "As we grow older, we grow both wiser and more foolish at the same 
> time."  (La Rochefoucauld)
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list