Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Sonntag, 30. Dezember 2012, 17:38

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

2

Sonntag, 30. Dezember 2012, 21:14

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

Montag, 31. Dezember 2012, 02:30

Do you mean...

... if this is what I want:

Quellcode

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:

Quellcode

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

4

Montag, 31. Dezember 2012, 09:03

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

Quellcode

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