Stopping a Sound

JustsomedesignerJustsomedesigner Member Posts: 28
edited November -1 in Working with GS (Mac)
Hi , I see you have a ''stop music'' behavior , but there is no stop sound behavior , im sure there is a way to do this but i dont know how :(

The thing is i have a sound playing ''on release'' of something im dragging , but what i want though is that when ''on press'' the sound stops..

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi, the following way uses an attribute for each sound that needs to be stopped, otherwise you'll stop all sounds, if there's more than one playing at the same time:

    Make an integer attribute, let's call it PressStop, set its value to 1. In the Play Sound behavior that you want to stop, put PressStop into the Volume via the Expression Editor

    In your Rule, When touch is pressed, add

    Change attribute PressStop to 0.

    Don't forget to set it back to 1 with another change attribute later if it needs to be heard (i.e if that same play sound behavior is used) again.

    If It's just one sound only, you could set it's volume to 0 (game.Audio.Sound Volume); but again, don't forget to change it back to 1 after, as you won't hear any other sounds playing.

    ----------------------------------------------
    http://davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.