Hi, newbie here.
I have a problem with a map closing button. As you can see in the attached images. The close button is right on the map and also closes the map BUT if I click on one of the hotspots inside the map it looks like in second image. I get directed to the other panorama but the close button still remains.
If you look at the code I have maybe someone can hint me to the right solution.
<layer name="map" url="gui_menu/map_square.jpg" keep="true" handcursor="false" capture="false"
align="rightbottom"
scale="0.30" scalechildren="true"
onclick="openmap();"
zorder="99999999999"
/>
<layer name="cl" url="gui_menu/x.png" keep="true" handcursor="true" capture="false" x="430" y="-440"
scale="1"
onclick="closemap();"
zorder="99999999999"
/>
<!-- 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(center,center);
set(layer[cl].onclick, closemap(); );
layer[cl].changeorigin(center,center);
set(bigscale,0.9);
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));
tween(layer[cl].x, 430);
tween(layer[cl].y, -440);
</action>
<!-- map closing - scale the map back to 0.10 of its image pixelsize -->
<action name="closemap">
set(layer[map].onclick, openmap(); );
layer[map].changeorigin(rightbottom,rightbottom);
tween(layer[map].x, 0);
tween(layer[map].y, 0);
tween(layer[map].scale, 0.30);
set(layer[cl].onclick, openmap(); );
layer[cl].changeorigin(rightbottom,rightbottom);
tween(layer[cl].x, 430);
tween(layer[cl].y, -440);
set(layer[mapspot].onclick, openmap(); );
layer[cl].changeorigin(rightbottom,rightbottom);
</action>
THIS IS WHERE I NEED TO DO SOMETHING... When mapspot is clicked I want to use the same function as when I close the map and use this .changeorigin(rightbottom,rightbottom);
<action name="closebutton">
set(layer[mapspot].onclick );
layer[cl].changeorigin(rightbottom,rightbottom);
</action>
<!-- the map spot images -->
<style name="mapspot" keep="true" url="skin/vtourskin_mapspot.svg" width="50" height="50" parent="map" align="center" edge="center" scale.mobile="2" />
<!-- active spot image (overlays the normal spot) -->
<!--<layer name="activespot" url="skin/vtourskin_mapspotactive.png" keep="true"
align="center" zorder="2" scale.mobile="2"
/>-->
<!-- FLYGPUNKTER -->
<layer name="fl1 mapspot" url="skin/infopunkter/m-1.svg" style="mapspot" x="400" y="130" zorder="1" width="50" height="50" onclick="mapspot_loadscene(scene_flygpunkt_1);" />
<layer name="fl2 mapspot" url="skin/infopunkter/m-2.svg" style="mapspot" x="100" y="310" zorder="1" width="50" height="50" onclick="mapspot_loadscene(scene_flygpunkt_2);" />
<layer name="fl3 mapspot" url="skin/infopunkter/m-3.svg" style="mapspot" x="245" y="75" zorder="1" width="50" height="50" onclick="mapspot_loadscene(scene_flygpunkt_3);" />
<layer name="fl4 mapspot" url="skin/infopunkter/m-4.svg" style="mapspot" x="25" y="-45" zorder="1" width="50" height="50" onclick="mapspot_loadscene(scene_flygpunkt_4);" />
<layer name="fl5 mapspot" url="skin/infopunkter/m-5.svg" style="mapspot" x="-225" y="240" zorder="1" width="50" height="50" onclick="mapspot_loadscene(scene_flygpunkt_5);" />
<layer name="fl6 mapspot" url="skin/infopunkter/m-6.svg" style="mapspot" x="-240" y="-230" zorder="1" width="50" height="50" onclick="mapspot_loadscene(scene_flygpunkt_6);" />
<layer name="fl7 mapspot" url="skin/infopunkter/m-7.svg" style="mapspot" x="-410" y="-370" zorder="1" width="50" height="50" onclick="mapspot_loadscene(scene_flygpunkt_7);" />
<layer name="fl8 mapspot" url="skin/infopunkter/m-8.svg" style="mapspot" x="75" y="-180" zorder="1" width="50" height="50" onclick="mapspot_loadscene(scene_flygpunkt_8);" />