Sie sind nicht angemeldet.

1

Donnerstag, 24. November 2011, 22:24

use of placeholders in slider-blend-cubes

I would like to use a placeholder for hotspots direction1...direction48 in order not to repeat setblend action in each scene (also all hotspot have to be declared at the begining of the xml for practical reasons)
how do I manage these placeholders. I looked at tutorials, but I don't understand all...)

declaring hotspots :

Quellcode

1
2
3
<hotspot name="direction1" style="hotspot_anim" zorder="5" visible="true" enabled="true" ath="-232" atv="-32" keep="true"  onclick="loadscene(scene1, null, MERGE, BLEND(1)); "  />
<hotspot name="direction2" style="hotspot_anim" zorder="5" visible="true" enabled="true" ath="-102" atv="22" keep="true"  onclick="loadscene(scene2, null, MERGE, BLEND(1)); "  />
...<hotspot name="direction48"...

hide hotspots at start :

Quellcode

1
2
3
4
5
<action name="start">
set(hotspot[direction1].visible,false);
set(hotspot[direction2].visible,false);
...set(hotspot[direction48].visible,false);
</action>

making first hotspot visible in scene :

Quellcode

1
2
3
4
5
<scene name="scene1" onstart="action(startscene);set (hotspot[direction1].visible,true ));">
	addcube(pano1);
	addcube(pano2);
	setblend(0);	
</scene>

setblend action in global.xml :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<action name="setblend">

	<plugin name="slider_grip" url="slider_grip.png" align="left" edge="center" parent="slider_bg" x="0" zorder="2" 
			dragging="if(pressed, 
						sub(dx, mouse.stagex, drag_stagex); 
						add(newx, drag_currentx, dx); 
						if(newx LT 0, set(newx,0));
						if(newx GT plugin[slider_bg].pixelwidth, copy(newx,plugin[slider_bg].pixelwidth));
						
						if(newx LT 0.5, set (hotspot[direction1].visible,true ));// if slider_grip is on pano1, direction1 is visible
						if(newx LT 0.5, set (hotspot[direction2].visible,false ));//if slider_grip is on pano2, direction2 is not visible
						if(newx GT 0.5, set (hotspot[direction1].visible,false ));//if slider_grip is on pano2, direction1 is not visible
						if(newx GT 0.5, set (hotspot[direction2].visible,true ));//if slider_grip is on pano2, direction2 is visible

(.../... removed useless script)   );"

		/>
		
</action>


Can someone help me for this ?

Thanks

Philippe

2

Dienstag, 29. November 2011, 11:41

Hi,

when you call an action with parameters, e.g.

Quellcode

1
test(parameter1, parameter2);


then you can use inside this action %1, %2 where you want the parameters, e.g.

Quellcode

1
2
3
4
<action name="test">
trace('parameter1=', %1);
trace('parameter2=', %2);
</action>


best regards,
Klaus

3

Montag, 5. Dezember 2011, 09:31

Thanks Klaus !
Seems to work on a small piece of my script; I'll try for the entire project.
Phil

Ähnliche Themen