how to change background sound in every scene

  • hi,i use this code to play different background sound in each scene,
    <krpano onstart="playsound(bg, backgroundmusic.mp3); loadscene(scene1,null,MERGE);">
    <plugin name="soundinterface" url="soundinterface.swf" alturl="soundinterface.js" preload="true" />
    <scene name="scene1">
    <events name="scene1events" onxmlcomplete="playsound(scene1sound, scene1music.mp3);" onremovepano="stopsound(scene1sound);" />
    </scene>
    <scene name="scene2">
    <events name="scene2events" onxmlcomplete="playsound(scene2sound, scene2music.mp3);" onremovepano="stopsound(scene2sound);" />
    </scene>
    </krpano>
    but i need to build 3 button in 3 languages as background sound. when i click 1 button the language in all scene will turn to 1 language.
    my idea is put 3 language in 3 folder, when 1 kind language onclick, all background sound url change.
    is it posibble, how to do?

  • hi,

    this is fairly simple to do.

    so the button Dutch is clicked. Then set for example set(_lang, Dutch);

    Code
    <scene name="scene_1" title="scene1" audio="thekrpanosongpart1.mp3" onstart=""  >

    and

    Code
    <events name="audio" keep="true" onnewscene="PlayAudio" />

    and

    Code
    <action name="PlayAudio">
    	set(_audio, calc:'audioplayer/audio/' + _lang + '/' + scene[get(xml.scene)].audio);
    	if(scene[get(xml.scene)].audio,
    		playsound(sound1,get(_audio));
    	,
    		stopsound(sound1);
    	);	
    </action>

    something like that.


    EDIT: sorry.. i forgot the language.. haha .. edited in..

    Hope it helps!
    Tuur *thumbsup*

  • hi Tuur, another problem i haven't found before.
    i also use set(_lang,chinese) in the first scene onstart, if i don't the first scene will link none mp3.
    when i go back to the first scene, the language will return to chinese.
    i also use action set(_lang,chinese) in startup but it doesn't work.
    how to set one kind language as default.

Participate now!

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