wait with messages
Scott Rossi
scott at tactilemedia.com
Thu May 1 13:10:55 EDT 2014
Hi Larry:
This is probably a situation where wait with messages will not work. If
you want to cancel sound 2 independently of sound 1, the second sound
needs to have its own play message so it can be canceled separately. This
is why I originally suggested the possibility of using a loop script or
similar.
You might try something like this (watch line wrap):
# PLAY SOUND 1
on openStack
play ac "sound1.wav"
send "playBack2" to me in 8 seconds
end openStack
# PLAY SOUND 2
command playBack2
play ac "sound2.wav" looping
end playBack2
# CANCEL PLAYBACK OF SOUND 2
# BEFORE OR AFTER PLAYBACK HAS STARTED
command cancelPlayBack2
cancel item 1 of line lineOffset("playBack2",pendingMessages()) of
pendingMessages()
play stop
end cancelPlayBack2
Now, any control that user can press to cancel the playback of sound 2
needs to include a call to the above "cancelPlayBack2" command in its
script. Note that this will also stop playback of any imported sound due
to the "play stop".
Regards,
Scott Rossi
Creative Director
Tactile Media, UX/UI Design
On 5/1/14 8:54 AM, "larry at significantplanet.org"
<larry at significantplanet.org> wrote:
>I have a splash screen and want to play 2 sounds in it, but allow the
>user to leave as soon as he/she wishes.
>
>This was my previous code and it worked fine:
>
>play audioclip "Sound1.wav"
>
>wait 8 seconds
>
>play audioclip "Sound2.wav" looping
>
>the problem with the above code is that the "wait" command meant that the
>user could not click on the button to go to the main screen until the 8
>seconds was up.
>
>and this is my new code:
>
>play audioclip "Sound1.wav"
>
>wait 8 seconds with messages
>
>play audioclip "Sound2.wav" looping
>
>the problem with the new code is this:
>
>IF the user clicks on the button (to go to the main screen) AFTER the 8
>seconds, then everything works fine - as it always did
>
>but IF the user clicks on the button DURING the 8 seconds, then
>everything goes completely CUCKOO!!
>
>So, the only difference in the expected result and the cuckoo result is
>that I added "with messages"
>
>Therefore, I am assuming that I need to so something with messages if the
>user clicks during the 8 seconds, but I have no idea what to do.
>
>TIA for any help
>
>Larry
>_______________________________________________
>use-livecode mailing list
>use-livecode at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list