How Can I return Ath Atv from a hotspot by Javascript?
Has someone an idea?
How Can I return Ath Atv from a hotspot by Javascript?
Has someone an idea?
Hi!
...
var ath = krpano.get("hotspot[bla].ath");
var atv = krpano.get("hotspot[bla].atv");
...
function getAthAtv(name){
return { ath: krpano.get("hotspot[" + name + "].ath"), atv: krpano.get("hotspot[" + name + "].atv") }
}
var obj = getAthAtv("bla");
alert("hotspot ATH=" + obj.ath);
And so on
Andrey
Thank you a lot ...
One more question to be more specific, in my case I did an action to create "tags" hotspots automatically, for example.
JavaScript
function CreateNewTag(){
krpano().call("CreateNewTag()");
}
XML
<!-- to create a new tag -->
<action name="CreateNewTag">
screentosphere(mouse.x, mouse.y, h, v);
txtadd(hs, 'hs_', get(hotspot.count));
addhotspot(get(hs));
set(hotspot[get(hs)].url, 'krpano/skin/tag.png');
copy(hotspot[get(hs)].ath, h);
copy(hotspot[get(hs)].atv, v;
</action>
How can I know the ath or atv if my hotspot is created by an action?
You already have ath, atv in this action. If the action is triggered by mouse click on the panorama, and you use screentosphere function, it returns ath, atv as 3 and 4 arguments. So
screentosphere(mouse.x, mouse.y, h, v);
returns ath, atv as h, and v (it could be any other variables' names)
could you give an example of this in javascript? I did in XML but I need this in JS
I appreciate your help
Look at Andrey's post.
Don’t have an account yet? Register yourself now and be a part of our community!