You are not logged in.

1

Wednesday, September 10th 2014, 6:56pm

how can I identify wight value of the previous layer?

I'm creating a layer type="container" with images inside, and the width varies according to viewing (landscape or portrait).

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
<layer name="ambientes01" keep="true" type="container" align="centertop" width="100%" height="100%" y="90" bgcolor="0xffffff" bgalpha="1" handcursor="false" zorder="50" >
<layer name="scrollarea" url="%SWFPATH%/plugins/scrollarea.swf" alturl="%SWFPATH%/plugins/scrollarea.js" align="centertop" width="100%" height="2000" direction="v" onloaded="setcenter(0,0);" >

<layer name="fotos01" type="image" url="thumbs/01.jpg" align="centertop" x="0" y="4" width="99%" height="prop" zorder="51" >
<layer name="barra01" keep="true" type="container" bgcolor="0x000000" bgalpha="0.7" align="centerbottom" x="0" y="0" width="100%" height="25%" visible="true" zorder="53" > 
<layer name="nomes01" style="button33" align="leftcenter" x="10%" y="0" html="data:amb01" zorder="54" />
</layer> </layer>

<layer name="fotos02" type="image" url="thumbs/02.jpg" align="centertop" x="0" y="?????" width="99%" height="prop" zorder="51" >
<layer name="barra02" keep="true" type="container" bgcolor="0x000000" bgalpha="0.7" align="centerbottom" x="0" y="0" width="100%" height="25%" visible="true" zorder="53" > 
<layer name="nomes02" style="button33" align="leftcenter" x="10%" y="0" html="data:amb02" zorder="54" />
</layer> </layer>

<layer name="fotos03" type="image" url="thumbs/03.jpg" align="centertop" x="0" y="?????" width="99%" height="prop" zorder="51" >
<layer name="barra03" keep="true" type="container" bgcolor="0x000000" bgalpha="0.7" align="centerbottom" x="0" y="0" width="100%" height="25%" visible="true" zorder="53" > 
<layer name="nomes03" style="button33" align="leftcenter" x="10%" y="0" html="data:amb03" zorder="54" />
</layer> </layer>

<layer name="fotos04" type="image" url="thumbs/04.jpg" align="centertop" x="0" y="?????" width="99%" height="prop" zorder="51" >
<layer name="barra04" keep="true" type="container" bgcolor="0x000000" bgalpha="0.7" align="centerbottom" x="0" y="0" width="100%" height="25%" visible="true" zorder="53" > 
<layer name="nomes04" style="button33" align="leftcenter" x="10%" y="0" html="data:amb04" zorder="54" />
</layer> </layer>

</layer>
</layer>


How do I assign a variable value to "Y"?

It would be possible to calculate the width size of the previous image and add the next image layer after 10px?


For each image appears below the previous image

Thank you for your help

2

Wednesday, September 10th 2014, 10:21pm

Hi,

that would be only possible via dynamic script/action code - e.g. the resulting pixel size can be get via the pixelwidth / pixelheight attributes and then used to calculate the resulting x / y positions.

E.g. the 'skin_addthumbs' <action> from the vtourskin.xml does something like this - it loops though a set of thumb images (from the <scene> element) and adds and calculates the x position of each thumb.

Best regards,
Klaus

Umalo

Professional

Posts: 1,051

Location: Osijek, Croatia, EU

  • Send private message

3

Thursday, September 11th 2014, 1:23am

Try like this:

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
<layer name="ambientes01" keep="true" type="container" align="centertop" width="10%" height="100%" y="90" bgcolor="0xffffff" bgalpha="1" handcursor="false" zorder="50" alpha="0" >
	<layer name="image_scrollarea" url="%SWFPATH%/plugins/scrollarea.swf" alturl="%SWFPATH%/plugins/scrollarea.js" align="centertop" width="100%" height="100%" direction="v" onloaded="setcenter(0,0); load_images();" />		
</layer>
<action name="load_images">
	for(set(i,1), i LE 5, inc(i),
		txtadd(image_name,'image_0',get(i)); txtadd(image_url,'%SWFPATH%/thumbs/0',get(i),'.jpg');						
		addlayer(get(image_name));
		copy(layer[get(image_name)].url, image_url);			
		set(layer[get(image_name)].keep, true);
		set(layer[get(image_name)].type, image);
		set(layer[get(image_name)].parent, 'image_scrollarea');
		set(layer[get(image_name)].align, centertop);
		set(layer[get(image_name)].x,0);
		set(layer[get(image_name)].y,0);			
		set(layer[get(image_name)].width,95%);
		set(layer[get(image_name)].height, prop);						
	  );
	  
		wait(load);			
		set(image_oy,5);		
	
	for(set(i,1), i LE 5, inc(i),		  
		txtadd(image_name,'image_0',get(i));			
		copy(layer[get(image_name)].y,image_oy);
		add(image_oy,layer[get(image_name)].pixelheight);
		add(image_oy,5);
	);
		
		copy(layer[ambientes01].height,image_oy);
		tween(layer[ambientes01].alpha,1);		
</action>


You should get something like this at the end:
Regards
Umalo

4

Thursday, September 11th 2014, 1:01pm

Try like this:

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
	for(set(i,1), i LE 5, inc(i),
		txtadd(image_name,'image_0',get(i)); txtadd(image_url,'%SWFPATH%/thumbs/0',get(i),'.jpg');						
		addlayer(get(image_name));
		copy(layer[get(image_name)].url, image_url);			
		set(layer[get(image_name)].keep, true);
		set(layer[get(image_name)].type, image);
		set(layer[get(image_name)].parent, 'image_scrollarea');
		set(layer[get(image_name)].align, centertop);
		set(layer[get(image_name)].x,0);
		set(layer[get(image_name)].y,0);			
		set(layer[get(image_name)].width,95%);
		set(layer[get(image_name)].height, prop);						
	  );
	  
		wait(load);			
		set(image_oy,5);		
	
	for(set(i,1), i LE 5, inc(i),		  
		txtadd(image_name,'image_0',get(i));			
		copy(layer[get(image_name)].y,image_oy);
		add(image_oy,layer[get(image_name)].pixelheight);
		add(image_oy,5);
	);
		
		copy(layer[ambientes01].height,image_oy);
		tween(layer[ambientes01].alpha,1);


You should get something like this at the end:index.php?page=Attachment&attachmentID=1446
Regards
Umalo

Thank you for helping me quickly.

But as I am beginner and I still have doubts.

I would like to use the code suggested by Uranus, but I have two problems:

- I am having an error:

plugin [image_01] loading error:%% SWFPATH / thumbs / 01.jpg
plugin [image_01] loading error:%% SWFPATH / thumbs / 02.jpg
plugin [image_01] loading error:%% SWFPATH / thumbs / 03.jpg
plugin [image_01] loading error:%% SWFPATH / thumbs / 04.jpg
plugin [image_01] loading error:%% SWFPATH / thumbs / 05.jpg

I checked and the folder is correct and the pictures too.

- My other problem is that each image must have an "onclick" function to direct a scene.

Many thanks for the help.

Umalo

Professional

Posts: 1,051

Location: Osijek, Croatia, EU

  • Send private message

5

Thursday, September 11th 2014, 2:07pm

I don't know what someone else has suggested you. I gave you working (tested) solution that is reading and adding plugins in your scrollarea plugin and assign right y values.
Adding additional onclick attribute would be additional line in my solution.
You obviously have some errors in your code...without shared code or online version can't help a lot.

This post has been edited 1 times, last edit by "Umalo" (Sep 13th 2014, 8:05pm)