[Squeakland] Question: delays, collections, object instance variables

Thomas Oeding Thomas.Oeding at gmx.de
Wed Mar 24 19:27:03 PST 2004


Forward for John Maloney <jmaloney at media.mit.edu>:

Re:
>... is there a way to synchronize on the completion of the sound or to insert something like a delay between the calls so they are heard as two sequential sounds?
>  There's no feature that is directly accessible to etoy tile users that would directly support this.   However, using textual scripting, one could invoke AbstractSound method #playAndWaitUntilDone to get the serial effect.&nbsp; Thus, for example, the following script makes the 'croak' sound be heard only after the 'peaks' sound has completed:    A disadvantage of this however is that each time it runs, it ties up the execution of all other ticking scripts until this one has completed, since #playAndWaitUntilDone freezes out all other activity until the wait is over.  Perhaps John Maloney can offer us some perspective and some advice here.  Cheers,   -- Scott 

The difficult part is arranging to wait for something to finish in the
context of an EToy script. As Scott says, doing a wait in one EToy
script stops all scripts for the duration of the wait, so you've to
use a different strategy.

What you could do is to make several different scripts. Each one will test to see
if a particular sound has finished. If it has, it will play the next sound,  start ticking
the script that waits for the newly started sound to end, and stop ticking
itself. (My Etoys programming is rusty, but I seem to recall that there are
tiles for starting and stopping the ticking of a particular script.)

There's probably no tile for checking if a sound has stopped playing, but
if you use textual scripting, the method "isPlaying" can be used.

Hope this helps!

	-- John





More information about the Squeakland mailing list