Sie sind nicht angemeldet.

1

Freitag, 4. September 2015, 14:56

problem to setup OnClick event and OnHover event in action(add_spots);

Hi,

while changing my static code to a more dynamic one,
i'm using a piece of code from Klaus virtual tour example and have modified to fit my needs
and it works fine but i meet 2 problems


-i cannot set up a style change in the OnClick :
(here i want to assign/change the style of the maps spot clicked so user know it's already visited)

-i cannot setup an OnHover event with showtext and if statement :
(here i want to display my showtext onhover the maps spot, but i find difficult to adapt my old static code to this dynamic one)

so it was my old code to add spots on maps :

Quellcode

1
2
3
4
5
6
7
8
9
<spot name="spot_map_pano_01_set_01" lat="14.745278" lng="100.490278" heading="92.82" style="DEFAULT2"
		      onhover="
		      if(interface_lang == french, 	showtext(titre  ,MAPTEXTSTYLE) );
		      if(interface_lang == english,        showtext(title ,MAPTEXTSTYLE) );
		      "
		      	onclick="copy(mapspotname,name);set(mapspot_just_clicked,true);call(panodata[pano_01_set_01_variables].pano_load);"
			   	
		      active="true" 
		      />

but as a static code i must add this piece of code for every new pano,
then i translated in dynamic code as :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<action name="add_map_spots">		
	for(set(i,0), i LT layer.count, inc(i),
				
			if(layer[get(i)].group == thumbs, <!-- thumbs name : thumb_01_set_01 -->
				
		<!-- thumb_01_set_01 to spot_map_pano_01_set_01 = SPOT_NAME -->
		txtreplace(SPOT_NAME, layer[get(i)].name, 'thumb', 'spot_map_pano'); 
		
		<!-- thumb_01_set_01 to pano_01_set_01_variables = SPOT_VARIABLES_NAME -->
		txtreplace(SPOT_V_N, layer[get(i)].name, 'thumb', 'pano');<!-- thumb_01_set_01 to pano_01_set_01 -->
		txtadd(SPOT_VARIABLES_NAME, get(SPOT_V_N), '_variables');<!-- pano_01_set_01 to pano_01_set_01_variables -->
	
		<!-- build the onclick action in a var and call it later in addspot() -->
		txtadd(spotclickevent, 'copy(mapspotname, name);', 'set(mapspot_just_clicked, true);', 'call(panodata[get(SPOT_VARIABLES_NAME)].pano_load);','plugin[maps].spot[get(SPOT_NAME)].loadstyle, blue;'); 
		txtadd(onhoverevent, 
		'if(interface_lang == french, 		showtext(get(panodata[get(SPOT_VARIABLES_NAME)].map_spot_french)  ,MAPTEXTSTYLE) );',
		    'if(interface_lang == english, 		showtext(get(panodata[get(SPOT_VARIABLES_NAME)].map_spot_english)  ,MAPTEXTSTYLE) );',
		 	);
			
			addspot(get(SPOT_NAME), get(panodata[get(SPOT_VARIABLES_NAME)].lat), get(panodata[get(SPOT_VARIABLES_NAME)].lng), get(panodata[get(SPOT_VARIABLES_NAME)].heading), false, get(spotclickevent), get(onhoverevent), null);
		  		);
	);
	</action>

so it works fine and every single maps spot has an OnClick specific action,
but changing style (plugin[maps].spot[get(SPOT_NAME)].loadstyle, blue;) in Onclick not works AND the OnHover action not works as expected *confused*

Any advice, help ?
Thanks *smile*

z