You are not logged in.

kangsj2277

Trainee

  • "kangsj2277" started this thread

Posts: 75

Location: Republic of Korea

  • Send private message

1

Tuesday, December 1st 2020, 6:11am

dynamic openurl

I want to generate openurl dynamically. As below.


for(set(i,0), i LT gallery[%1].img.count, inc(i),
txtadd(hname, get(gallery[%1].img[get(i)].name),'_home');
txtadd(ihome, get(gallery[%1].img[get(i)].home),'');


addlayer(get(hname));
set(layer[get(hname)].url,'img/bt_link.png');
set(layer[get(hname)].parent, gallery_scrollarea);
set(layer[get(hname)].edge, center);
set(layer[get(hname)].align, left);
set(layer[get(hname)].crop, '0|0|90|30');
set(layer[get(hname)].onovercrop, '90|0|90|30');
set(layer[get(hname)].ondowncrop, '90|0|90|30');
mul(layer[get(hname)].x, stagewidth, i);
add(layer[get(hname)].x, 245);
set(layer[get(hname)].y, -280);
set(layer[get(hname)].onclick, openurl('get(ihome)',_blank));
div(layer[get(hname)].ox, stagewidth, 2);
trace('home=',get(ihome));
);




as above openurl('get(ihome)',_blank)); Can't use it dynamically? *cry*
someone please help

panoyun

Intermediate

Posts: 234

Location: Somalia

  • Send private message

2

Tuesday, December 1st 2020, 9:12am

Source code

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
<gallery name="gallery_0">
			<img name="img_0" linkurl="https://krpano.com/home/"/>
			<img name="img_1" linkurl="https://krpano.com/forum/wbb/index.php?page=Thread&amp;threadID=18021"/>
			<img name="img_2" linkurl="https://krpano.com/docu/actions/#openurl"/>
	</gallery>


	<action name="action_qmffocfodlwi" autorun="onstart">
	for(set(i,0), i LT gallery[gallery_0].img.count, inc(i),
		txtadd(hname, get(gallery[gallery_0].img[get(i)].name),'_home');
		addlayer(get(hname));
		set(layer[get(hname)],
		    type=container,          
			keep=true, 
			bgcolor=0xF1F1F1,
			bgalpha=1.0,
			align=lefttop,
			edge=lefttop,
			width=100,
			height=100,
			x=0,
			y=0,
			maskchildren=false,
			bgroundedge=0,
			visible=true,
			handcursor=true,
			bgcapture=true,
			onclick=openurl('get(linkurl)',_blank),
			linkurl=get(gallery[gallery_0].img[get(i)].linkurl),
		);
		calc(layer[get(hname)].x,(i * (layer[get(hname)].width + 20)));
		trace('layer[',get(hname),']=','"',get(layer[get(hname)].linkurl),'"');
	);
	</action>

*smile*

kangsj2277

Trainee

  • "kangsj2277" started this thread

Posts: 75

Location: Republic of Korea

  • Send private message

3

Wednesday, December 2nd 2020, 2:09am

Your code works really great! This is the feature I wanted. Thank you. Good luck! *thumbsup*

kangsj2277

Trainee

  • "kangsj2277" started this thread

Posts: 75

Location: Republic of Korea

  • Send private message

4

Wednesday, December 2nd 2020, 10:28am

One more question, is there any way to make the layer invisible if I have linkurl=null?

panoyun

Intermediate

Posts: 234

Location: Somalia

  • Send private message

5

Wednesday, December 2nd 2020, 10:47am

Source code

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
37
38
39
 <gallery name="gallery_0">
			<img name="img_0" linkurl=""/>
			<img name="img_1" linkurl="https://krpano.com/forum/wbb/index.php?page=Thread&amp;threadID=18021"/>
			<img name="img_2" linkurl="https://krpano.com/docu/actions/#openurl"/>
			<img name="img_3" linkurl=""/>
			<img name="img_4" linkurl="https://krpano.com/home/"/>
	</gallery>


	<action name="action_qmffocfodlwi" autorun="onstart">
	for(set(i,0), i LT gallery[gallery_0].img.count, inc(i),
		txtadd(hname, get(gallery[gallery_0].img[get(i)].name),'_home');
		addlayer(get(hname));
		set(layer[get(hname)],
		    type=container,          
			keep=true, 
			bgcolor=0xF1F1F1,
			bgalpha=1.0,
			align=lefttop,
			edge=lefttop,
			width=100,
			height=100,
			x=0,
			y=0,
			maskchildren=false,
			bgroundedge=0,
			visible=true,
			handcursor=true,
			bgcapture=true,
			onclick=openurl('get(linkurl)',_blank),
			linkurl=get(gallery[gallery_0].img[get(i)].linkurl),
		);
		calc(layer[get(hname)].x,(i * (layer[get(hname)].width + 20)));
		if(layer[get(hname)].linkurl === null OR layer[get(hname)].linkurl === "",
		set(layer[get(hname)].visible,false);
		);
		trace('layer[',get(hname),']=','"',get(layer[get(hname)].linkurl),'"');
	);
	</action>

kangsj2277

Trainee

  • "kangsj2277" started this thread

Posts: 75

Location: Republic of Korea

  • Send private message

6

Thursday, December 3rd 2020, 2:42am

Your code works correctly. It's been a lot of power to me. Thank you very much. I wish you always good luck. *thumbsup*