Prevent audio from being played more than 1 time during 1/2 second


(Markus Bjerre) #1

Hey! So I am currently adding some button click sounds in my scene. The buttons are controlling a timeline that scrolls through pictures and I am trying to find out how to make the audio only play once during it’s being played, and wait for timeline to pause. Currently, if the user is fast enough, the audio will be played several times which makes it really inappropriate since the timeline takes half a second to move the pictures to the next in line. So, what i want is that the audio file to play a maximum of 1 time every half a second after the click.

How it works right now:

  • User is clicking on the button
  • Sound is heard and the timeline is played which is moving the pictures (takes 1/2 second)
  • User clicks the button during the timeline is being played and **you can hear the sound**
  • Timeline is in it's new fixed position.
  • repeat
  • **How I want it to be:**
  • User is clicking on the button
  • Sound is heard and the timeline is played which is moving the pictures (takes 1/2 second)
  • User clicks the button during the timeline is being played and **you can not trigger the sound during this**
  • Timeline is in it's new fixed position.
  • repeat
  • I know one way to do it by adding a transparent image over the button when the timeline is moving but there should be some way of doing it with javascript right?

    Much appreciated for any advice!


    (strmiska) #2

    better you create a permanent symbol. so the control is independent from the slideshow.
    don´t use audiotrigger on the same timeline.


    (Markus Bjerre) #3

    Thanks for your advice strmiska. The problem however is that the audio is being triggered on the buttons itself and they are independent and not used in the timeline, they only trigger the timeline. So, what I really need is a javascript which prevents the audio from being played more than once every half a second. This is a common usage in computer games and it shouldn’t be impossible to do with javascript right?


    (strmiska) #4

    you don´t need javascript - here´s a solution just only using timelines.
    create an invisible button above the gamebutton. this starts sound and game.
    then it moves off.
    audioPlay.hype.zip (311.0 KB)