Turning sound off on scene exit?

  • I have the following sound code for a hotspot inside a scene for my tour, although I have the keep=false set the sound continues to play even when a new scene has been loaded. The audio is specific to only one scene.

    if this is not the correct way to stop a sound when leaving a scene please let me know what to do.

    Thank you in advance.

    Rick

  • Hi,

    there are several possibilities:

    1. call stopsound(name) to stop the sound before calling the loadpano/loadscene actions
    2. call stopallsounds() to all sounds before calling the loadpano/loadscene actions
    3. use a global onremovepano event and call there stopallsounds() , e.g.

      Code
      <events onremovepano="stopallsounds()" />
    4. use a scene local onremovepano event and call there stopallsounds() or stopsound(name) , e.g.

      Code
      <scene ...>
      ...
      <events name="sceneevents" onremovepano="stopsound(snd);" />
      ...
      </scene>

    btw - keep="false" can't and shouldn't be used for the soundinterface plugin - the sound-'interface' plugin only adds new actions for playing sound, but not the sounds itself,

    best regards,
    Klaus

  • Klaus,

    Thank you very much, I was so hung up on getting the keep= working I didn't even check the stop sound actions. Sorry major brain fart. Thank you very much for the help.

    Rick

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!