Repeating sounds [was Re: Temporary picts]

J. Landman Gay jacque at hyperactivesw.com
Thu Mar 21 12:26:01 EST 2002


Shari wrote:
> 
> >>So the solution has to be to avoid modal dialogs. You could do that by
> >>creating your own dialog stack and storing it as a substack in your main
> >>stack. You'd fill the text field with the appropriate response and set
> >>the button labels to whatever you want. Then display it as modeless:
> >>
> >>   modeless "myDialog"
> >
> >This would definitely be an option for the current project...
> 
> Didn't work *sigh*

Try this (watch out for line wraps):

local theCurSnd

on startSounds
  play "darn you.wav"
  go cd "info" of stack "dLog" as modeless
  send "playSnd" to me in 1 second
end startSounds

on playSnd
  if the sound is done then
    put "darn you.wav,aaah.wav,goodie.wav,oh yeah.wav,talk to you.wav"
into theSndList
    put (itemoffset(theCurSnd,theSndList) mod the number of items in
theSndList)+1 into theNextNum
    put item theNextNum of theSndList into theCurSnd
    play theCurSnd
  end if
  send playSnd to me in 1 second
end playSnd

on cancelMsgs
  play stop
  repeat for each line l in the pendingmessages
    if l contains "playSnd" then cancel (item 1 of l)
  end repeat
end cancelMsgs

You'd trigger it off by calling "startsounds". Whenever you want the
sounds to stop, call "cancelMsgs". Unless your sounds are very, very
short, there is no reason to call "playsnd" any more often than once per
second, and you might be able to lengthen that amount of time even more
depending on the length of your shortest sound. There's no point in
piling up any more pending messages than necessary.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the metacard mailing list