Sie sind nicht angemeldet.

1

Freitag, 24. September 2010, 17:32

Toggle using one button

Hello everyone,

I've created a button with an action to open a google map but I want to use it in a toggle fashion to close it and haven't found an example to toggle.

Any help would be appreciated

Robert

Zitat

<plugin name="map_btn" visible="false" url="newcontrols.png" crop="172|34|29|25" keep="true"
align="leftbottom" x="172" y="0" handcursor="true" alpha="0" zorder="1000"
onclick="action(showmap,maps);"
onhover="showtext(Show MAP,csmall);" onover="tween(alpha,1,0.1)"
onout="tween(alpha,0,0.5)" onloaded="delayedcall(1,set(visible,true));"/>

<action name="showmap">
set(plugin[%1].visible,true);
tween(plugin[%1].alpha,1);
set(autorotate.enabled,true);
</action>


2

Freitag, 24. September 2010, 18:18

Ok, actually got it working on based on a great example. Only thing now is what would I have to do to show two different bits of text. Would the average user understand "Toggle Map" as show/hide map?

Zitat

<plugin name="map_btn" visible="false" url="newcontrols.png" crop="172|34|29|25" keep="true"
align="leftbottom" x="172" y="0" handcursor="true" alpha="0" zorder="1000"
onclickA="action(showmap,maps); set (onclick, onclickB() );"
onclickB="action(hidemap,maps); set(onclick, onclickA() );"
onclick="onclickA();"
onhover="showtext(Show MAP,csmall);" onover="tween(alpha,1,0.1)"
onout="tween(alpha,0,0.5)" onloaded="delayedcall(1,set(visible,true));"/>

<action name="showmap">
set(plugin[%1].visible,true);
tween(plugin[%1].alpha,1);
set(autorotate.enabled,true);
</action>

<action name="hidemap">
tween(plugin[%1].alpha,0,0.5,default, set(plugin[%1].visible,false) );
set(autorotate.enabled,true);

3

Freitag, 24. September 2010, 18:38

Hi Robert,

You could change the setting of onhover, like this:

Quellcode

1
2
onclickA="action(showmap,maps); set(onclick, onclickB() ); set(onhover,showtext(Hide MAP,csmall));"
onclickB="action(hidemap,maps); set(onclick, onclickA() ); set(onhover,showtext(Show MAP,csmall));"


SAlut.

4

Freitag, 24. September 2010, 20:01

Hi Michel,

Doesn't seem to work. The text doesn't appear at all and it only opens the map and doesn't close it.

<plugin name="map_btn" visible="false" url="newcontrols.png" crop="172|34|29|25" keep="true"
align="leftbottom" x="172" y="0" handcursor="true" alpha="0" zorder="1000"
onclickA="action(showmap,maps); set (onclick, onclickB(); set(onhover,showtext(Show MAP,csmall));"
onclickB="action(hidemap,maps); set(onclick, onclickA(); set(onhover,showtext(Hide MAP,csmall));"
onclick="onclickA();"
onhover="showtext(Show Map,csmall)"
onover="tween(alpha,1,0.1)" onout="tween(alpha,0,0.5)" onloaded="delayedcall(1,set(visible,true));"/>

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »rbudnikas« (24. September 2010, 20:16)


5

Freitag, 24. September 2010, 20:26

Hi,

This must work:
onclickA="action(showmap,maps); set(onclick, onclickB() ); set(onhover,showtext(Hide MAP,buttonstyle));"

Zitat

..the map and doesn't close it.
perhaps the missing </action> in your code:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<plugin name="map_btn" visible="false" url="newcontrols.png" crop="172|34|29|25" keep="true"
align="leftbottom" x="172" y="0" handcursor="true" alpha="0" zorder="1000"
onclickA="action(showmap,maps); set(onclick, onclickB() ); set(onhover,showtext(Hide MAP,buttonstyle));"
onclickB="action(hidemap,maps); set(onclick, onclickA() ); set(onhover,showtext(Show MAP,buttonstyle));"
onclick="onclickA();"
onhover="showtext(Show MAP,csmall);" onover="tween(alpha,1,0.1)"
onout="tween(alpha,0,0.5)" onloaded="delayedcall(1,set(visible,true));"/>

<action name="showmap">
set(plugin[%1].visible,true);
tween(plugin[%1].alpha,1);
set(autorotate.enabled,true);
</action>

<action name="hidemap">
tween(plugin[%1].alpha,0,0.5,default, set(plugin[%1].visible,false) );
set(autorotate.enabled,true); 
</action>


SAlut.

6

Freitag, 24. September 2010, 20:36

Hi Michel,

I copied your code exactly and due to the buttonstyle parameter it gives me an error. changed it to csmall and still doesn't work.

7

Freitag, 24. September 2010, 20:41

Hi,

buttonstyle ... yes, sorry ;-) ...
What krpano version are you using? Perhaps this can be the problem...

8

Samstag, 25. September 2010, 01:54

ver. 1.0.8