Play sound - on and off button?


Could I ask for someone’s guidance please.

I have created an action button on the tool bar that plays a sound file that I have looped…all straightforward.

However, I’d like to give a command to stop the sound from playing in a loop of a p,Ayer wishes. Out to listen to it anymore. I cannot figure out what to put in the “Repeat until condition is true” line.

What specifically would I put in there to create a condition to stop playing the looped sound file…what would the exact text be in the expression builder line?

Your help would be greatly appreciated.

Thank you.

I’m not sure if the final result will be exactly what you want but you can try this:

Place a Dynamic Property trait (let’s call it StopSound) in the piece that’s triggering the sound. Give it an initial property of 0.

In your “Repeat until condition is true”, state StopSound = 1

Put a menu command on the Dynamic Property called Stop Sound that will appear when a player right-clicks the piece. Have it increment the value of StopSound by 1.

When a player right-clicks the piece, they’ll see the Stop Sound command. Clicking it will change the StopSound variable to 1 and the loop will stop.

You’ll probably also want to include a Reset command on the Dynamic Property, and some way to trigger it, to reset it to 0 when necessary.

Thanks Dr,

I’m away from my PC for a couple of days. I’ll look into your solution when I get back.

Thanks for the help. Much appreciated

Happy Wanderer