You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

m.conche

Beginner

  • "m.conche" started this thread

Posts: 21

Location: France

  • Send private message

1

Sunday, January 10th 2021, 3:01pm

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


Source code

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


On my script.js


Source code

1
2
3
4
5
6
7
8
9
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


Source code

1
2
3
 <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

m.conche

Beginner

  • "m.conche" started this thread

Posts: 21

Location: France

  • Send private message

2

Tuesday, January 19th 2021, 2:33pm

I solved it thanks :)