call xml action from js by clicking on html button

  • Hi all !

    I'm learning the JS interface.

    Today, i would like to run a xml action from a JS file by clicking on a HTML button

    I have my index.html


    Code
    <script src="script.js"></script>
    <div id="title"></div>
    <div class="button" onclick=" getSceneTitleName(); ">Get Scene Title Name</div>



    On my script.js

    Code
    function getSceneTitleName(){
    	if(krpano){
    	krpano.set("scene[get(xml.scene)].title","Nouveau titre");
    	<!-- Here i would like to call the skin_update_scene_infos action of the /skin/vtourskin.xml -->
    	var title=  krpano.get("scene[get(xml.scene)].title");
    	console.log(title);
    	document.getElementById("title").innerHTML = title ; 
    }
    }




    and my /skin/vtourskin.xml


    Code
    <action name="skin_update_scene_infos" scope="local">
    	...the actions...
    </action>




    I tried krpano.call("skin_update_scene_infos()") but doesn't seems to work in my case...
    I think the answer should be here : https://krpano.com/docu/js/#top bu i can't figure it out....


    Thank you all


    Cheers from france,


    Matthias

Participate now!

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