This works only for the hotspots which are in the current scene.
Zitat
hotspot[hotspotname].url);
Zitat
get(scene[scenename].hotspot[hotspotname].url);
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
Zitat
You can get hotspot data if it is global, i.e. keep="true"
: https://pame.virtualtuur.comyes... its not that simple.I thought all the XML information are accessible like JavaScript DOM -> Am I wrong?
|
|
Quellcode |
1 2 3 4 5 6 |
<scene name="a" test="a" ... /> <hotspot name="a"... /> ... </scene> <scene name="b" test="b" ... /> <hotspot name="b"... /> ... </scene> |
Dieser Beitrag wurde bereits 20 mal editiert, zuletzt von »indexofrefraction« (17. September 2022, 09:07)
[b]yes... its not that simple.I thought all the XML information are accessible like JavaScript DOM -> Am I wrong?
the scenes are special... only the active scene is in the memory
or more precisely only the content of the active scene.
![]()
Quellcode
1 2 3 4 ... ...
if you are in scene[a] ...
all other scenes attributes are available but not their content xml
eg. scene[b].test is available, but the scene[b] content xml (hotspot[b]) is not parsed / available
side note: it is possible to parse the special attribute scene[b].content,
but this is just a raw unparsed string (" ... ")
and not part of the active krpano data in memory.
layers & hotspots are removed on scene change, unless they have keep=true
but this does NOT mean you could access other scenes hotspots if they have keep=true
if that scene has not been loaded before also the hotspot doesn't exist.
the global xml is read once, the scene xml is integrated on scene loading
so if you need a hotspot/layer on for all scenes you define it global (outside of the scenes)
the global scene array only holds each scenes attributes. there is no scene[a].hotspot[a]
the scene content xml is parsed into the krpano global, eg hotspot[a]
these are main mechanisms of krpano.
[/b][/b][/b][/b]
them
Benutzerinformationen überspringen
Wohnort: Netherlands
Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<arr name="htsp">
<item name="s1" sc="scene_1" ath="10" atv="10" col="0x336699" click="loadscene(scene_2);" />
<item name="s2" sc="scene_1" ath="20" atv="-10" col="0x000000" click="loadscene(scene_3);" />
<item name="s3" sc="scene_2" ath="30" atv="-20" col="0xff0000" click="loadscene(scene_1);" />
<item name="s4" sc="scene_2" ath="30" atv="20" col="0x00ffff" click="loadscene(scene_3);" />
<item name="s5" sc="scene_3" ath="-20" atv="10" col="0xff0000" click="loadscene(scene_1);" />
<item name="s6" sc="scene_3" ath="20" atv="10" col="0x0000ff" click="loadscene(scene_2);" />
</arr>
<events name="dohtsp" keep="true" onnewscene="CreateHotspots();" />
<action name="CreateHotspots">
for(set(i,0),i LT arr[htsp].item.count,inc(i),
copy(h, arr[htsp].item[get(i)]);
if(get(h.sc) == xml.scene,
addhotspot(get(h.name), hs);
hs.loadstyle(htsp);
set(hs,
ath=calc(h.ath),
atv=calc(h.atv),
bgcolor=calc(h.col),
onclick=calc(h.click)
)
)
);
</action>
|
: https://pame.virtualtuur.comHi,
here a simple example:
https://www.virtualtuur.com/krpano/120/help/hotspot_array/1/
xml:
https://www.virtualtuur.com/krpano/120/h…rray/1/tour.xml
![]()
Quellcode
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15for(set(i,0),i LT arr[htsp].item.count,inc(i), copy(h, arr[htsp].item[get(i)]); if(get(h.sc) == xml.scene, addhotspot(get(h.name), hs); hs.loadstyle(htsp); set(hs, ath=calc(h.ath), atv=calc(h.atv), bgcolor=calc(h.col), onclick=calc(h.click) ) ) );
Hope it helps,
Tuur![]()