You are not logged in.

Dear visitor, welcome to 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.


Wednesday, November 21st 2018, 12:37am

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?



Wednesday, November 21st 2018, 4:48pm

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

I therefore assume this is still the case ?


Monday, November 26th 2018, 11:39pm


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,


Tuesday, November 27th 2018, 11:13am

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


Tuesday, November 27th 2018, 3:30pm

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



Monday, December 3rd 2018, 5:09pm

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....?