• Hello


    I would like to have a button in my virtual tour that when clicked it would play a mp3 audio file - and when the user clicks it again it would stop the sound?
    Each panorama in the tour needs its own individual audio file assigned to the audio button per that panorama - Thanks in advance for any help!!


    Kent

  • Hi,

    here is an example for this: (for the 1.0.8 beta 8)

    add/load the soundinterface in the "first" xml:

    Code
    <plugin name="soundinterface" url="soundinterface.swf" preload="true" keep="true" />

    and a button to play/stop the sound:

    Code
    <plugin name="soundbutton" ... onclick="action(playorstopsound);" />

    and then add this in every pano xml, it will start or stop the sound (a custom variable "isplaying" is used to save the state if the sound is playing or not):
    <action name="playorstopsound">
    if(isplaying == true, stopsound(sound1);set(isplaying,false); , playsound(sound1, sound1.mp3);set(isplaying,true); );
    </action>

    and also add an event that stops the sound from the previous pano:

    Code
    <events onxmlcomplete="if(isplaying == true, stopsound(sound1);set(isplaying,false); );" />

    best regards,
    Klaus

Participate now!

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