You are not logged in.

1

Sunday, October 19th 2014, 7:23pm

activate hotspot when clicking on another

Hello,

I am trying to customize flyout hotspots code - I need flyout to execute, when clicking on another hotspot. I found post of a person who was trying to achieve exactly same thing: Help!!! How to activate one hotspot when clicking on another?

It seems to be simple, but I m still new in coding and syntax, so probably making some silly mistake. Here is what I have, and well.. it doesn't work:

<hotspot
name="soldat_img"
url="skin/soldat.jpg"
distorted="true"
ath="5"
atv="-45"
scale="0.1"
alpha="0"
autoalpha="true"
rx="0" ry="0" rz="0"
backup_rx="0"
backup_ry="0"
backup_rz="0"
backup_scale="0"
backup_alpha="0"
flying="0.0"
/>

<hotspot
name="soldat_hot"
url="skin/camera.png"
ath="15"
atv="-45"
distorted="true"
rx="-20" ry="0" rz="0"
onclick="if(soldat_img.flying == 0.0, flyout(soldat_img) ); if(soldat_img.flying == 1.0, flyback(soldat_img));"/>

<action name="flyout">
copy(hotspot[%1].backup_rx,hotspot[%1].rx);
copy(hotspot[%1].backup_ry,hotspot[%1].ry);
copy(hotspot[%1].backup_rz,hotspot[%1].rz);
copy(hotspot[%1].backup_scale,hotspot[%1].scale);
copy(hotspot[%1].backup_alpha,hotspot[%1].alpha);

tween(hotspot[%1].rx, 0);
tween(hotspot[%1].ry, 0);
tween(hotspot[%1].rz, 0);
tween(hotspot[%1].scale, 1);
tween(hotspot[%1].alpha,1,0.4);

tween(hotspot[%1].flying, 1.0);
</action>

Umalo

Professional

Posts: 1,051

Location: Osijek, Croatia, EU

  • Send private message

2

Sunday, October 19th 2014, 11:13pm

This should do the trick:

Source code

1
2
3
4
5
6
7
8
9
10
<hotspot name="soldat_img"  keep="true" url="skin/soldat.jpg"  distorted="true" ath="0" atv="0" scale="0" alpha="0" autoalpha="true" rx="0" ry="0" rz="0" backup_rx="0" backup_ry="0" backup_rz="0" backup_scale="0" backup_alpha="0" flying="0.0" />
<hotspot name="soldat_hot"  keep="true" url="skin/camera.png" ath="15" atv="0" distorted="true" rx="0" ry="0" rz="0" onclick=" if(hotspot[soldat_img].flying == 0.0, flyin(soldat_img) );  if(hotspot[soldat_img].flying == 1.0, flyout(soldat_img)); "/>

<action name="flyout">		
	tween(hotspot[%1].scale, 0); tween(hotspot[%1].alpha,0); tween(hotspot[%1].flying, 0.0);
</action>

<action name="flyin">			
	tween(hotspot[%1].alpha,  1.0); tween(hotspot[%1].flying, 1.0); tween(hotspot[%1].scale,  1.0); 
</action>

3

Tuesday, October 21st 2014, 1:30pm

Ah, yes.. just as I thought. Syntax mistake. Works perfectly now, thank you!

Umalo

Professional

Posts: 1,051

Location: Osijek, Croatia, EU

  • Send private message

4

Wednesday, October 22nd 2014, 12:42am

Note that your trouble was not syntax related. It was conceptual mistake "loosing" [not kept] hotspots outside scene definition if not loaded with MERGE option. And if(soldat_img.flying... is range (attribute) outside other hotspot so not visible to other hotspots. Without checking it via hotspot[name].attribute not possible to get valid IF resolution