Preventing a focus sound from playing on start

Any ideas on a slick way to prevent the focus sound from playing on start when you have a button that starts with the focus

I'm managing focus sound like so:

<g id="ButtonFocus">
<set style:backgroundFrame="1" />
<event name="PlayFocusSound" />
</g>

function playFocusSound() {
Player.audio.effect.play('file:///dvddisc/ADV_OBJ/main.aca/focus.wav', 1, function focusSoundCallback(status){});
}






Answer this question

Preventing a focus sound from playing on start

  • Dietz

    Wow, so many to choose from. Thanks!

    Why an object element rather than event handler Just curious.


  • Blkbird

    Could you elaborate on how you would actually play the sound via an object in markup

    I was under the impression that system (ie player) events could only be triggered by script...

    Thanks!


  • k_Prasad

    Several ways...

    • Make your event handler ignore the first event after every markup page load
    • Put the cue that calls ButtonFocus inside a parent container that has a begin of (eg) 1s so that it won't fire immediately
    • Create an alternate ButtonFocusNoSound animation, and use a toggle to ensure that ButtonFocusNoSound fires once, and then subsequently ButtonFocus fires (eg, by making your begin expression an 'and' clause with value that is toggled by ButtonFocusNoSound)
    • etc.

    I would probably prefer the second approach, and I would play sounds via an <object> element rather than an event handler (assuming playing the sound is the only thing it does).



  • can_thing_beat_hulk

    Why write code to do something the sytem will do for you :-)

  • Jeremy Jarrell

    Can you please post as a new thread (since this is a new question ). Thanks

  • Preventing a focus sound from playing on start