You are not logged in.

1

Sunday, December 30th 2012, 5:38pm

Set a layer dynamically as a child

I'm trying to create an action to create a layer and sub-layers, and even sub-layers of a sublayer.
Is this possible? Any hint on how to do this?
Thanks,
Marco

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

2

Sunday, December 30th 2012, 9:14pm

Yes, it's possible
For set some layer as child

Just set parent attribute as parent layer name

Regards
Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN

3

Monday, December 31st 2012, 2:30am

Do you mean...

... if this is what I want:

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
			<layer	name="img_bg1"
					url="plugins/textfield.swf"
					keep="true" type="container" visible="false"
					align="center"
					width="720" height="605" x="0" y="0" zorder="10"
					background="true" backgroundcolor="0xFFFFFF" backgroundalpha="0.7"
					roundedge="20">
				<layer	name="title1"
						url="plugins/textfield.swf"
						enabled="false"
						align="top" edge="top"
						width="700" x="0" y="10"
						autoheight="true"
						background="false"
						border="false"
						roundedge="10"
						css="text-align:left; color:#444444; font-family:Arial; font-size:20px;"
						html="[b]TITOLO[/b]"
						/>
				<layer	name="close_img_bg1"
						url="plugins/textfield.swf"
						enabled="true"
						align="topright" edge="topright"
						width="30" x="10" y="10"
						autoheight="true"
						background="true" backgroundcolor="0x000000" backgroundalpha="0.9"
						border="false"
						roundedge="10"
						css="text-align:center; color:#888888; font-family:Arial; font-size:20px;"
						html="[b]X[/b]"
						onclick="switch(layer[img_bg1].visible); set(layer[info_data1].visible,false);"
						/>

                                        ...

					</layer>


...and this is the action to build the above stucture:

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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<layer name="button" visible="true" url="skin/zoominhotspot.png" orientation="portrait" keep="true" align="righttop" x="50" y="50" onclick="checkoriantation();" />


		
<action		name="checkoriantation">
			if(layer[%1].orientation == 'landscape', build_hbox(), build_vbox());
			</action>
			
			
<action		name="build_hbox">			

			</action>


<action		name="build_vbox">			

				set(layer[img_bg1].'url,plugins/textfield.swf');
				set(layer[img_bg1].keep,true);
				set(layer[img_bg1].visible,false);
				set(layer[img_bg1].align,center);
				set(layer[img_bg1].width,720);
				set(layer[img_bg1].height,605);
				set(layer[img_bg1].x,0);
				set(layer[img_bg1].y,0);
				set(layer[img_bg1].zorder,10);
				set(layer[img_bg1].background,true);
				set(layer[img_bg1].backgroundcolor,'0xFFFFFF');
				set(layer[img_bg1].backgroundalpha, 0.7);
				set(layer[img_bg1].roundedge,20);

					set(layer[title1].parent,layer[img_bg1]);
					set(layer[title1].url,'plugins/textfield.swf');
					set(layer[title1].enabled,false);
					set(layer[title1].align,top);
					set(layer[title1].edge,top);
					set(layer[title1].width,700);
					set(layer[title1].x,0);
					set(layer[title1].y,10);
					set(layer[title1].autoheight,true);
					set(layer[title1].background,false);
					set(layer[title1].border,false);
					set(layer[title1].roundedge,10);
					set(layer[title1].css,'text-align:left; color:#444444; font-family:Arial; font-size:20px;');
					set(layer[title1].html,'[b]TITOLO[/b]');
					set(layer[title1].height);
					set(layer[title1].height);

					set(layer[close_img_bg1].parent,layer[img_bg1]);
					set(layer[close_img_bg1].url,'plugins/textfield.swf');
					set(layer[close_img_bg1].enabled,true);
					set(layer[close_img_bg1].align,topright);
					set(layer[close_img_bg1].edge,topright);
					set(layer[close_img_bg1].width,30);
					set(layer[close_img_bg1].x,10);
					set(layer[close_img_bg1].y,10);
					set(layer[close_img_bg1].autoheight,true);
					set(layer[close_img_bg1].background,true);
					set(layer[close_img_bg1].backgroundcolor,'0x000000');
					set(layer[close_img_bg1].backgroundalpha,0.9);
					set(layer[close_img_bg1].border,false);
					set(layer[close_img_bg1].roundedge,10);
					set(layer[close_img_bg1].css,'text-align:center; color:#888888; font-family:Arial; font-size:20px;');
					set(layer[close_img_bg1].html,'[b]X[/b]');
					set(layer[close_img_bg1].onclick,'switch(layer[img_bg1].visible); set(layer[info_data1].visible,false);');

                        ...

			</action>


Am I doing well?

As you can see, my intension is to click on a button(hotspot) to open an image inside a box(textfield) and show some info.
Also, images can be portrait or landscape: how can I check orientation of the photo without giving the parameter "orientation" to the button?
Thanks.
Regards,
Marco

Posts: 1,082

Location: Russia, Kaliningrad

  • Send private message

4

Monday, December 31st 2012, 9:03am

HiCheck geometry sizes to detect orientation.
It's common cases for programming logic
About parent:
if you need this

Source code

1
2
3
<layer name="PAPA">
    <layaer name="CHILD" />
</layer>


Then just do so
addlayer(PAPA);
addlayer(CHILD);
set(layer[CHILD].parent,PAPA);

Regards
Andrey
VRAP - desktop VR content player based on krpano.
Common tasks in one place in one click! Discussion thread
DOWNLOAD for MAC
DOWNLOAD for WIN