Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Sonntag, 10. Januar 2021, 15:01

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


Quellcode

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


Quellcode

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


Quellcode

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

2

Dienstag, 19. Januar 2021, 14:33

I solved it thanks :)