Sie sind nicht angemeldet.

1

Freitag, 1. Oktober 2010, 19:32

Close multiple images/textfields etc.

Hello,

Is there a simple way to close multiple components when opening another. For instance I have googlemaps, an about, image info, etc. Right now the user can click open all components and they will stay open. I'd like to open one while closing the others. I know I would have to include a statement on the onclick to call all the actions that relate to each and every button or hotspot but that seems to be a lot of repeat coding. If there is a simpler way please let me know.

Thanks

Robert

rdhoore108

Schüler

Beiträge: 89

Wohnort: Belgium

Beruf: Systems and Network Administrator

  • Nachricht senden

2

Samstag, 2. Oktober 2010, 10:49

Robert,

You can write an action called "SwitchComponent" (or whatever) and pass as a parameter the name of the component you wish to make visible.

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<plugin name="thisplugin" onclick="SwitchComponent(thisplugin);" />
<plugin name="thatplugin" onclick="SwitchComponentthatplugin);" />
<plugin name="thishotspot" onclick="SwitchComponent(thishotspot);" />

<action name="SwitchComponent">
  if ("%1" == "thisplugin",
    tween(plugin[thisplugin].alpha, 1);
  ,
    tween(plugin(thisplugin].alpha, 0);
  );
  if ("%1" == "thatplugin",
    tween(plugin[thatplugin].x, 100);
  ,
    tween(plugin(thisplugin].x, -500);
  );
  if ("%1" == "thishotspot",
    tween(hotspot[thishotspot].alpha, 1);
  ,
    tween(hotspot(thishotspot].alpha, 0);
  );
</action>

(I haven't tested this, but this is how I would go about it.)

Good luck.
- Ronny D'Hoore

3

Samstag, 2. Oktober 2010, 16:48

Thanks, I'll give it a try.

4

Samstag, 2. Oktober 2010, 18:13

i see there is a ( on one side of the name and a ] on the other. in case the code does not work. it might be fine i do not know if the symbols have to match to work.

5

Montag, 4. Oktober 2010, 10:25

Sorry but I'm not understanding the switch component and how to integrate it into what I have below. Right now I have each hide action in the onclickA which works but when you want to go back to a particular plugin you have to click it twice. At some point this may also get to big if there are more than 5 actions. If it can be done without too many changes to what i have I would like to find a better solution. Thanks in advance.

Zitat

<plugin name="panorama_btn" visible="true" url="newcontrols.png" crop="0|34|109|25" keep="true"
align="bottomleft" x="0" y="0" handcursor="true" enabled="true" capture="true" alpha="0"
zorder="1000" onover="tween(alpha,1,0.1)"
onclickA="action(showabout,aboutus); action(hideimg_info,img_info); action(hidemap,maps); action(hidehelp,img_nav); set (onclick, onclickB() );"
onclickB="action(hideabout,aboutus); set (onclick, onclickA() );"
onclick="onclickA();"
onhover="showtext(Show About EyeCandy Virtual Imaging, csmall);" onout="tween(alpha,0,0.5)"
onloaded="delayedcall(1,set(visible,true));"/>

<action name="showabout">
set(plugin[%1].visible,true);
tween(plugin[%1].alpha,.85);
set(autorotate.enabled,false);
set(plugin[panorama_btn].onhover, showtext(Hide About EyeCandy Virtual Imaging, csmall));
</action>

<action name="hideabout">
tween(plugin[%1].alpha,0,0.5,default, set(plugin[%1].visible,false) );
set(autorotate.enabled,true);
set(plugin[panorama_btn].onhover, showtext(Show About EyeCandy Virtual Imaging, csmall));
</action>

<plugin name="info_btn" visible="false" url="newcontrols.png" crop="141|34|29|25" keep="true"
align="leftbottom" x="141" y="0" handcursor="true" alpha="0" zorder="1000"
onhover="showtext(Image Information,csmall)"
onclickA="action(showimg_info,img_info); action(hideabout,aboutus); action(hidemap,maps); action(hidehelp,img_nav); set (onclick, onclickB() );"
onclickB="action(hideimg_info,img_info); 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="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); action(hideabout,aboutus); action(hideimg_info,img_info); action(hidehelp,img_nav);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="showimg_info">
set(plugin[%1].visible,true);
tween(plugin[%1].alpha,.85,);
set(autorotate.enabled,false);
set(plugin[info_btn].onhover, showtext(Hide Image Information, csmall));
</action>

<action name="hideimg_info">
tween(plugin[%1].alpha,0,0.5,default, set(plugin[%1].visible,false) );
set(autorotate.enabled,true);
set(plugin[info_btn].onhover, showtext(Show Image Information, csmall));
</action>

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

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

<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(Show Navigation Help,csmall)"
onclickA="action(showhelp,img_nav); action(hideabout,aboutus); action(hideimg_info,img_info); action(hidemap,maps); set (onclick, onclickB() );"
onclickB="action(hidehelp,img_nav); set (onclick, onclickA() );"
onclick="onclickA();"
onover="tween(alpha,1,0.1)" onout="tween(alpha,0,0.5)" onloaded="delayedcall(1,set(visible,true));"/>

<action name="showhelp">
set(plugin[img_nav].visible,true);
tween(plugin[img_nav].alpha,.85);
set(plugin[help_btn].onhover, showtext(Hide Navigation Help, csmall));
set(autorotate.enabled,false);
</action>

<action name="hidehelp">
tween(plugin[img_nav].alpha,0,0.5,default, set(plugin[img_nav].visible,false) );
set(plugin[help_btn].onhover, showtext(Show Navigation Help, csmall));
set(autorotate.enabled,true);
</action>

6

Freitag, 15. Oktober 2010, 19:23

Back to Basics - Getting Frustrated

This is almost getting ridiculous.

I am trying everything to get a switch working. I tried using the example below and it does not work.

I have created two button hotspots and am at a loss as to how to get them to work.

Can someone please help as there are no examples that show a simple example

Zitat

<hotspot name="info1"
url="images/fyi.png"
ath="-30"
atv="1.45"
scale="0.2"
alpha="0.6"
onhover="showtext(Click to Learn More, csmall);"
onover="tween(alpha,1);tween(scale,0.5);"
onout="tween(alpha,0.6);tween(scale,0.2);"
onclick="action(open,aboutus);"
/>

<hotspot name="camera1"
url="images/camera.png"
ath="30"
atv="1.45"
scale="0.2"
alpha="0.6"
onhover="showtext(Click to Learn More, csmall);"
onover="tween(alpha,1);tween(scale,0.5);"
onout="tween(alpha,0.6);tween(scale,0.2);"
onclick="action(open,maps);"
/>

<action name="switch">
if ("%1" == "aboutus",
tween(plugin[aboutus].alpha, 1);
,
tween(plugin(aboutus].alpha, 0);
);
if ("%1" == "maps",
tween(plugin[maps].alpha, 1);
,
tween(plugin(maps].alpha, 0);
);
</action>

7

Freitag, 15. Oktober 2010, 20:23

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
<action name="switch">
if (%1 == aboutus,
tween(plugin[aboutus].alpha, 1);
,
tween(plugin[aboutus].alpha, 0);
);
if (%1 == maps,
tween(plugin[maps].alpha, 1);
,
tween(plugin[maps].alpha, 0);
);
</action>

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Job.1« (15. Oktober 2010, 21:43)


9

Freitag, 15. Oktober 2010, 20:28

Isn't it the same as what I have?

11

Samstag, 16. Oktober 2010, 00:38

Oh I see, said the blind man. "" Thanks

And then so how do I fire it. I have to fire an action to open it, or do I just use the statement

onclick="switch(aboutus);"

onclick="switch(maps);"

12

Samstag, 16. Oktober 2010, 09:19

aboutus is a plugin ? an action ? a hotspot ? I don't see it in your code *confused*

13

Samstag, 16. Oktober 2010, 14:12

they're both plugins.

About us is a textfield and maps is googlemaps.

I have two hotspots.

Sorry, I'm use to pano2vr and not a programmer. I figure if I can at least get two working I can apply it to the rest of my the plugins that have to act the same way.

Thanks for your help!

14

Samstag, 16. Oktober 2010, 14:59

Ok, I have it half working. Although each hotspot button fires off each plugin, what it doesn't do is when one is clicked close the other automatically. Here is my code.

Zitat

<hotspot name="info1"
url="images/fyi.png"
ath="-30"
atv="1.45"
scale="0.2"
alpha="0.6"
onhover="showtext(Click to Learn More, csmall);"
onover="tween(alpha,1);tween(scale,0.5);"
onout="tween(alpha,0.6);tween(scale,0.2);"
onclick="switch(plugin[aboutus].visible);"
/>

<hotspot name="camera1"
url="images/camera.png"
ath="30"
atv="1.45"
scale="0.2"
alpha="0.6"
onhover="showtext(Click to Learn More, csmall);"
onover="tween(alpha,1);tween(scale,0.5);"
onout="tween(alpha,0.6);tween(scale,0.2);"
onclick="switch(plugin[maps].visible);"
/>

<action name="switch">
if (%1 == aboutus,
tween(plugin[aboutus].alpha, 1);
,
tween(plugin(aboutus].alpha, 0);
);
if (%1 == maps,
tween(plugin[maps].alpha, 1);
,
tween(plugin(maps].alpha, 0);
);
</action>

15

Montag, 18. Oktober 2010, 13:54

Is this right or wrong

Hello,

Can someone please confirm whether this is right or wrong? Obviously many have looked at it, some offer fixes that are vague and then don't want to follow through. Don't get me wrong I appreciate the help but it is very frustrating when people just disappear.

I'm new to krpano and not a programmer but learning. I just need to tweek some of these settings.

Thanks

Robert

16

Montag, 18. Oktober 2010, 16:19

Hi Robert,

Your are trying to make a custom action with name switch... switch() is already an native Krpano action...
try something like:

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
32
33
34
35
36
<hotspot name="info1"
url="images/fyi.png"
ath="-30"
atv="1.45"
scale="0.2"
alpha="0.6"
onhover="showtext(Click to Learn More, csmall);"
onover="tween(alpha,1);tween(scale,0.5);"
onout="tween(alpha,0.6);tween(scale,0.2);"
onclick="my_switch(aboutus);"
/>

<hotspot name="camera1"
url="images/camera.png"
ath="30"
atv="1.45"
scale="0.2"
alpha="0.6"
onhover="showtext(Click to Learn More, csmall);"
onover="tween(alpha,1);tween(scale,0.5);"
onout="tween(alpha,0.6);tween(scale,0.2);"
onclick="my_switch(maps);"
/>

<action name="my_switch">
if (%1 == aboutus,
tween(plugin[aboutus].alpha, 1);
,
tween(plugin(aboutus].alpha, 0);
);
if (%1 == maps,
tween(plugin[maps].alpha, 1);
,
tween(plugin(maps].alpha, 0);
);
</action> 


Hope this help...
-------------------------------------------------------------------------
" I take and returns back ..."

Zitat

Obviously many have looked at it, some offer fixes that are vague and then don't want to follow through. Don't get me wrong I appreciate the help but it is very frustrating when people just disappear.
Yes, also frustrating is when people simply do not appear and just asks questions and takes what they need... Of course it takes some effort to take the time in answering... That's why the answers are so valuable... (I just take this opportunity to make think... Nothing personal)

SAlut.



17

Montag, 18. Oktober 2010, 20:23

Hello Michel,

Thanks for the help but I am not a programmer and my programmer who does understand this got into a very bad accident and is disabled. Rather than looking for someone else to do the work I thought I would give this a try as I need to keep my business going. I'm not stupid and have come a long way in a very short period of time.

So as an example when someone sends me a very cryptic example of code do you think I should ignore it and right away ask someone else if it is right or wrong. If you noticed when the original post was made, I have been attempting to get it working, and looking at other examples, but looking at the example given how would I think it was already in KRpano. Also if you notice I have asked other questions and still waiting on a possible answer, for example when the next version is coming out with the fix for mis-aligned tiles. I still don't have an answer for that and I have clients that want to see their properties on an ipad.

Having said all that if I knew as much as some of you already know on the workings of krpano, I would certainly give and not only take as you implied. No point giving back something I don't know that much about. This way Krpano becomes better overall if everyone can show it's capabilities and I really don't believe someone in France, UK, Germany, or elsewhere would really be my competition.

Sorry if it the help is of a time limit on this forum. Teaching is one of the greatest gifts one man can offer another.

Robert