Sie sind nicht angemeldet.

1

Montag, 27. September 2010, 20:01

Problem with buttons

Hello Everyone,

I have a user interface that has buttons on it. I was able to get googlemaps to open using the maps button. Still working on figuring out how to close using the same button but I have a help button that simply opens an image with instructions. Problem is that it won't open. Could you take a look at my code and see if I am missing something.

Thanks! Robert

Zitat

<plugin name="help_btn" visible="false" url="newcontrols.png" crop="523|34|29|25" keep="true"
align="rightbottom" x="2" y="0" handcursor="true" alpha="0" zorder="1000"
onhover="showtext(Navigation Help,csmall)"
onclickA="action(showhelp,help); set (onclick, onclickB() );"
onclickB="action(hidehelp,help); set (onclick, onclickA() );"
onclick="onclickA();"
onover="tween(alpha,1,0.1)" onout="tween(alpha,0,0.5)" onloaded="delayedcall(1,set(visible,true));"/>

<plugin name="help"
url="images/navigation.png"
align="center" x="10" y="10"
alpha="0"
visible="false"
onhover="showtext(Click Image to Close, csmall);"
onclick="action(hidehelp,get(name));" />

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

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

2

Dienstag, 28. September 2010, 13:37

Try this:

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<plugin name="help_btn" visible="true" url="newcontrols.png" crop="523|34|29|25" keep="true"
 align="rightbottom" x="2" y="0" handcursor="true" alpha="0" zorder="1000"
 onhover="showtext(Navigation Help,csmall)"
onclick="if (plugin[help].visible == true, action(hidehelp), action(showhelp));"
 onover="tween(alpha,1,0.1)" onout="tween(alpha,0,0.5)" onloaded="delayedcall(1,set(visible,true));"/>
 
 <plugin name="help"
 url="images/navigation.png"
 align="center" x="10" y="10"
 alpha="0"
 visible="false"
 onhover="showtext(Click Image to Close, csmall);"
 onclick="action(hidehelp,get(name));" />
 
 <action name="showhelp">
 set(plugin[help].visible,true);
 tween(plugin[help].alpha,1);
 set(autorotate.enabled,false);
 </action>
 
 <action name="hidehelp">
 tween(plugin[help].alpha,0,0.5,default, set(plugin[help].visible,false) );
 set(autorotate.enabled,true); 
 </action>

3

Dienstag, 28. September 2010, 18:21

Thanks srisa for the coding but it doesn't work. In both cases the action fires off because the autorotate stops and starts. The image doesn't appear. I've made sure the image is actually in the right directory and still nothing. Like I said the core of my code works on my googlemaps the only difference is that it opens a png file.

any other suggestions would be more than greatly appreciated.

Robert

4

Dienstag, 28. September 2010, 19:34

i just set this up yesterday it will work. obviosly you will need to change the actions to do what you want them to do. this will open and close the map with one button. i use an arrow in addition that rotates 180 degrees to let the user see what way the map will slide when clicking.

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<plugin name="mapslogo"
			url="icons/map.png"
			origin="leftcenter" edge="leftcenter" x="0" y="10" 
		    parent="mapstab"
			onhover=""
			state="closed"
        	onclick="if(state == closed, action(openmap), action(closemap));" 
			scale=".75"
			zorder="1"
			keep="true"
			rotate="0"
			/>

<action name="openmap">

			tween(area.width, 50%,2);
			tween(area.x, 40%,2);
			
			tween(plugin[mapsarrow].rotate,180,2);
			set(plugin[mapslogo].state, opened); wait(1);
					
</action>

<action name="closemap">

			tween(area.width, 75%,2);
			tween(area.x, 5%,2);
			tween(plugin[mapsarrow].rotate,0,2);
			set(plugin[mapslogo].state, closed);
						
</action>

5

Dienstag, 28. September 2010, 20:02

Here's what I've got and it still doesn't open image. I feel like a complete idiot - somethings work and when you apply them to others they don't. - I don't get it.

Zitat

<plugin name="help_btn" visible="true" url="newcontrols.png" crop="523|34|29|25" keep="true"
align="rightbottom" x="2" y="0" handcursor="true" alpha="0" zorder="1000"
onhover="showtext(Navigation Help,csmall)"
state="closed"
onclick="if(state == closed, action(showhelp), action(hidehelp));"
onover="tween(alpha,1,0.1)" onout="tween(alpha,0,0.5)" onloaded="delayedcall(1,set(visible,true));"/>

<plugin name="help"
url="images/navigation.png"
align="center" x="10" y="10"
alpha="0"
visible="false"
onhover="showtext(Click Image to Close, csmall);"
onclick="action(hidehelp,get(name));" />

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

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

6

Mittwoch, 29. September 2010, 09:31

I think you are missing the "keep" attribute for the "help" plugin. Add another attribute to the existing ones, keep="true".

7

Mittwoch, 29. September 2010, 14:56

Thanks a bunch - That's worked. Don't know why I keep forgetting or can't get my head around putting that in there. I though keep=true is used to keep commands in every pano. If that is the case why wouldn't it work in only the first one?

Robert