turning on/off hotspots and keep state when moving to next pano

  • Hi
    I made a couple of hotspots and a button to switch them off and on again. This works fine. But when moving to the next pano, the script wants to position the hotspots like they are written down in my scene tags. So, when they are switched off there is an error message that the spot is not found.
    How can I prevent to load the hotspots in a new scene, when they have been switched off in the previous scene?
    My switching button is a plugin with different alpha-values: when the hotspots are turned off the plugin is set to alpha="0.5" , when they are turned on, it's set to alpha="1".
    So, I think I must put with the scene to be loaded an if statement before loading the hotspots, something like

    if (plugin[hotspotswitch].alpha=="0.5", don't load hotspots; load hotspots)

    but I don't exactly know how to do this...maybe someone can help?

    regards,

    Edited once, last by Muxi (April 27, 2015 at 9:02 PM).

  • you can see it here http://artesphera.de/pano/_vt/Kieler_Foerde/tour.html
    in the upper right there are the buttons to switch off/on the different classes of hotspots. This works fine, but when loading a new scene I need the actual state of the hotspots, weather they are on or off and when off then not to load them when loading the scene...
    but the code is mixed up with php and also all xml-files are php-files...thus, I tried to only describe what's happening and what's my problem...
    anyway, I show you the code, there's some php but it's only a for/next-loop which should be understandable maybe even without php-knowledge

    here are the code snippets refering to the problem:

    button:

    Code
    <plugin name="hotspots_off" style="skin_base" crop="32|0|32|32" keep="true"  align="lefttop" x="159" y="0" alpha="1" scale="1" handcursor="true" zorder="15" parent="hs_switcher" 
    				onloaded=""
    				onhover="set(zorder,999);set(style, skin_base|tooltip);showtext(Hotspots Panos an/aus,hswitch);tween(scale,1.2);"
    				onout="set(zorder,15);tween(scale,1);"
    				
    				onclick="off_switcher(get(name));all_hs()"

    switcher to set button to alpha 0.5 or 1:

    Code
    <!--switcher for upper right hotspot-buttons-->
    	<action name="off_switcher" >
     	switch(plugin[%1].alpha,0.5,1.0);
    	</action>

    action to remove or reload hotspots:

  • 1. Use some varialbe to track state of the hotspts e.g. hotspots_visible="true" Set it first time e.g. onstart
    2. use on new pano event to start one action (hotspots_visibility_hanldler) every time you load new scene. In this action you check your varialbe and if true run the loop through all hotspots in memory and turn their visibility on else false
    3. Don't forget to set your hotspots styles visible attribute to false so that at start all hotstpos are "hidden" before your visiblity handler action.

    Try and if you fail send me an mail, I will make you code in new version of side menu as I already have your code ;)

Participate now!

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