How to access other scene's hotspot info?

  • Hello,

    I want to retrieve other scene's hotspot attributes and tried following code:

    Quote

    hotspot[hotspotname].url);

    This works only for the hotspots which are in the current scene.


    So I tried adding scene information like this but doesn't work:

    Quote

    get(scene[scenename].hotspot[hotspotname].url);


    I thought all the XML information are accessible like JavaScript DOM -> Am I wrong?

    Could someone explaing how this works?

    Best Regards,
    hyung

  • Quote

    You can get hotspot data if it is global, i.e. keep="true"

    or when you have them all defined in an array.

    Tuur *thumbsup*

  • I thought all the XML information are accessible like JavaScript DOM -> Am I wrong?

    yes... its not that simple.

    the scenes are special... only the active scene is in the memory
    or more precisely only the content of the active scene.

    Code
    <scene name="a" test="a" ... /> 
    	<hotspot name="a"... /> ... 
    </scene>
    <scene name="b" test="b" ... /> 
    	<hotspot name="b"... /> ... 
    </scene>


    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 ("<hotspot name="b"... /> ... ")
    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.
    *smile*

  • Hello indexofrefraction!

    Thank you very much for your super clear explanation!! *thumbsup*

    I believe Klaus built it this way for efficient memory management.

    I think I can solve my problem by using hotspotname+events(onnewpano).

    Thank you again for your explanation! *thumbup*

    Best Regards,
    hyung


    them

  • Hi,

    here a simple example:
    https://www.virtualtuur.com/krpano/120/help/hotspot_array/1/

    xml:
    https://www.virtualtuur.com/krpano/120/hel…rray/1/tour.xml


    Hope it helps,
    Tuur *thumbsup*

  • Hi Tuur!

    Short codes but tell me lot of things!

    Thank you for your example! *thumbsup*

    Best Regards,
    hyung


    Hi,

    here a simple example:
    https://www.virtualtuur.com/krpano/120/help/hotspot_array/1/

    xml:
    https://www.virtualtuur.com/krpano/120/hel…rray/1/tour.xml


    Hope it helps,
    Tuur *thumbsup*

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!