onClick event - change image  

Share your tips and tricks here or get help with any Panotour 2.0 problem!
No bug reports (of any kind) in this forum!
no avatar
mattkay
Member
 
Posts: 49
Joined: Mon Mar 24, 2014 6:10 am

onClick event - change image

by mattkay » Fri Mar 28, 2014 5:21 am

hello all,

In my tour there is a layer which contains a togglebutton:

Code: Select all
 <layer name="togglebutton"
         keep="true"
         url="%FIRSTXML%/graphics/togglebutton/button_aerial_view_grey.png"
         align="topleft"
         x="30"
         y="30"
         zorder="7"
         state="true"
         onclick="togglebuttonOnClick"
         alpha="0.7"
         onover="tween(alpha,1.0,0.5,easeOutQuad);"
         onout="tween(alpha,0.7,0.5,easeOutQuad);"
         visible="false"
         />


When I click this button it changes to this button: graphics/togglebutton/button_mini_ramp.png
Perfect! :)

But I want this button to change as well when I click on a specific hotspot of my tour:

Code: Select all
<action name="onclickspotpoint30">[color=#FF0040]Which action goes here to change my toggle button?[/color]
         </action>



Now maybe you say use the same action like above: onclick"toggelbuttonOnClick"
This action looks like this:

Code: Select all
<action name="togglebuttonOnClick">
    if (state,
      set(state, false);
          if (xml.scene != pano26,
            mainloadscene(pano26);
          );
      lookat(118.000000, 28.056680, 123.886640);
   
      set(url,%FIRSTXML%/graphics/togglebutton/button_mini_ramp.png);
     ,
      set(state, true);
          if (xml.scene != pano22,
            mainloadscene(pano22);
          );
      lookat(get(panoview.h), get(panoview.v), get(panoview.fov));
   
      set(url,%FIRSTXML%/graphics/togglebutton/button_aerial_view_grey.png);
    );
  </action>



I tried this, but it did not work.


thank you for your help!

no avatar
mattkay
Member
 
Posts: 49
Joined: Mon Mar 24, 2014 6:10 am

Re: onClick event - change image

by mattkay » Fri Mar 28, 2014 4:34 pm

ok, now I found out how to "communicate" with the layer (togglebutton) that contains the image I want to change when clicking on a hotspot:

Code: Select all
<action name="onclickspotpoint30">tween(plugin[togglebutton].x, 300, 1.0);
         </action>


This action moves my layer to the right, after a click on the hotspot. Does anybody know how to change the image of the layer when clicking on the hotspot (spotpoint30)? I imagine it has to look something like this:

Code: Select all
<action name="onclickspotpoint30">imageurl(plugin[togglebutton]= button_mini_ramp.png);
         </action>


Does anyone know the correct syntax of the code?

thank you!

no avatar
mattkay
Member
 
Posts: 49
Joined: Mon Mar 24, 2014 6:10 am

Re: onClick event - change image

by mattkay » Fri Mar 28, 2014 7:08 pm

I found the solution to change the image in the layer. For anyone interested in it:

<action name="onclickspotpoint31">
set(layer[togglebutton].url, %FIRSTXML%/graphics/togglebutton/button_mini_ramp.png);
</action>

But now I have to find also how to apply a new link to this button.


Return to Using Panotour / Panotour Pro

Who is online

Users browsing this forum: No registered users and 6 guests