Virtual tour with multiple maps

  • Hello,
    I'm making a virtual tour with a map like the one in the bkeller example. If I add another floor map, when I go to the scene with the second map the first one it doesn't close, and it will stay open in all the scenes. I've read in another post to try to add an action to close the map when a scene is selected, something like this:

    <action name="showhidemaps">
    if(%1 == "map1",
    set(plugin[map1].visible,true);
    set(plugin[map2].visible,false);
    );

    if(%1 == "map2",
    set(plugin[map1].visible,false);
    set(plugin[map2].visible,true);
    );
    </action>

    or

    <action name="showhidemaps">
    if(%1 === map1,
    set(plugin[map1].visible,true);
    set(plugin[map2].visible,false);
    );

    if(%1 === map2,
    set(plugin[map1].visible,false);
    set(plugin[map2].visible,true);
    );
    </action>

    and in the scene I've added

    onstart="showhidemaps(map1);"

    but in this case all maps will disappear.

    This this the code I've used to add a map in the tour (the same as the bkeller example).

    - <scene name="scene_..." title="..." onstart="updateradar();">
    <action name="updateradar">set(layer[activespot].parent, spot1); set(layer[radar].parent, spot1); set(layer[radar].heading, 180);</action>
    - <!-- active spot image (overlays the normal spot)
    -->
    <layer name="activespot" url="graphics/camicon_red.png" keep="true" align="lefttop" zorder="2" scale.mobile="2" />
    - <!-- radar layer (overlays the normal spot too, but is behind the activespot image)
    -->
    <layer name="radar" keep="true" url.flash="%SWFPATH%/plugins/radar.swf" url.html5="%SWFPATH%/plugins/radar.js" align="center" zorder="1" scale.mobile="1.5" fillalpha="0.5" fillcolor="0x7F5F3F" linewidth="1.0" linecolor="0xE0E0A0" linealpha="0.5" />
    - <!-- action for loading the scene when clicking on the map spots
    -->
    - <action name="mapspot_loadscene">
    if(layer[map].scale GT 0.25,
    - <!-- special mode for zoomed map: hide big map, loadscene, show small map
    -->
    set(layer[map].enabled, false); tween(layer[map].alpha, 0.0, 0.25, default, loadscene(%1, null, MERGE, BLEND(1)); set(layer[map].onclick, openmap(); ); layer[map].changeorigin(righttop,righttop); set(layer[map].x, 0); set(layer[map].y, 0); set(layer[map].scale, 0.25); set(events[sceneload].onloadcomplete, delayedcall(1, tween(layer[map].alpha, 1.0, 0.5, default, set(layer[map].enabled, true); ); ); ); ); ,
    - <!-- small map: just load the scene
    -->
    loadscene(%1, null, MERGE, BLEND(1)); );
    </action>
    - <!-- the map image
    -->
    <layer name="map" url="images/map_1.png" keep="true" handcursor="false" capture="false" align="righttop" scale="0.15" scalechildren="true" alpha="1.0" distorted="true" onclick="openmap();" />
    - <!-- map opening - scale the map up to 100% (or smaller if the screen is too small)
    -->
    <action name="openmap">set(layer[map].onclick, closemap(); ); layer[map].changeorigin(righttop,righttop); set(bigscale,1); if(layer[map].imagewidth GT stagewidth, div(bigscale, stagewidth, layer[map].imagewidth); ); tween(layer[map].x, 0); tween(layer[map].y, 0); tween(layer[map].scale, get(bigscale));</action>
    - <!-- map closing - scale the map back to 25%
    -->
    <action name="closemap">set(layer[map].onclick, openmap(); ); layer[map].changeorigin(righttop,righttop); tween(layer[map].x, 0); tween(layer[map].y, 0); tween(layer[map].scale, 0.25);</action>
    - <!-- hotspot animation code
    -->
    <action name="hotspot_animate">if(loaded, inc(frame,1,get(frames),0); mul(ypos,frame,frameheight); txtadd(crop,'0|',get(ypos),'|',get(framewidth),'|',get(frameheight)); delayedcall(0.03, hotspot_animate() ); );</action>
    - <!-- the map spot images
    -->
    <style name="mapspot" keep="true" url="images/camicon.png" parent="map" align="lefttop" edge="center" scale.mobile="2" />
    </scene>


    The map it's perfectly working.

    Any help will be appreciated, thank you.

Participate now!

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