disabling buttons while sound file is playing

Jan Schenkel janschenkel at yahoo.com
Mon Oct 14 05:26:00 EDT 2002


--- Robin Banerjee <robinb at cogs.susx.ac.uk> wrote:
> I've been trying to disable a set of buttons while a
> sound file is playing
> (so that any mouse clicks while the sound is playing
> are ignored).  But the
> following doesn't seem to work - the mouseUp action
> simply takes place after
> the sound stops playing):
> 
> on openCard
>   disable button 8
>   play "oct2002/sa1.aif"
>   wait until the sound is done
>   enable button 8
> end openCard
> 
> 
> Another query:  how do I specify multiple buttons
> without using a repeat
> control structure? (e.g., button 8 to 12 doesn't
> seem to do it)
> 
> -- 
> Dr Robin Banerjee
> 

Hi Robin,

For your first problem: you can insert a 'flushEvents'
call at the end of your openCard handler ; this will
"eat" up all the events (or only those of a certain
type) that happened after the openCard started. You'll
probably want:

  on openCard
    disable button 8
    play "oct2002/sa1.aif"
    wait until the sound is done
    enable button 8
    get flushEvents(all)
  end openCard

But do look at the Transcript dictionary for all the
options.

As for your second issue: you'll need a repeat
structure ; though depending on what you want to
accomplish, it could be interesting to 'group' the
buttons and then work on the group.

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!?
Faith Hill - Exclusive Performances, Videos & More
http://faith.yahoo.com



More information about the use-livecode mailing list