Sie sind nicht angemeldet.


Mittwoch, 21. November 2018, 00:37

Get array of every hotspot via Javascript


I am trying to get an array of every hotspot that is present in a tour regardless of which scene it belongs to. So for example krpano.get("scene") will give me an array of every scene but need an equivalent for hotspots.

I would also like to establish the parent scene of each hotspot.

Any suggestions as to the best way forward?



Mittwoch, 21. November 2018, 16:48

.....Although I just found a similar question in…d&threadID=9355

I therefore assume this is still the case ?


Montag, 26. November 2018, 23:39


As you can see the post, the hotspots are generated on-the-fly when scene is created. (Pro: same hotspotnames for different scenes, loading Just In Time).

Apparently I will face to the same issue and I see following scenarios:
a) create my own xml tag with hotspot attributes and scenename and load the particular hotspots on the onstart event of the scene;

b) create all hotspots outside the <scene /> tag and add the attribute scenename=parent_scene to each hotspot. On onstart event of the scene just set enabled=true for the hostposts where the scenename=currentscene.
(Cons: performance and memory issue when big image hotspots).

Has anybody a better idea?
Thank all of you,


Dienstag, 27. November 2018, 11:13

you need to understand that :
- you can access all scene properties by scene[x].property
- but there is only one scene content active at a time

that means you cannot access the hotspots defined in any scene,
only the ones of the active loaded scene.

so either you parse all scenes xml manually by using scene[x].content
or you build your hotspot information as an array outside the scenes,
and then add them dynamically onxmlcomplete or onnewscene for each scene


Dienstag, 27. November 2018, 15:30

For my purposes I have gone down the parsing scene content route.



Montag, 3. Dezember 2018, 17:09

I suppose by way of a feature request - it would be useful to have access to the full XML. Parsing the xml text is fine albeit a bit clumsy and I would hazard a guess that eventually, parsing may fail due to future version changes in the xml - naming conventions, syntax changes, etc....?