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

Mittwoch, 7. Juli 2010, 14:36

onresize infinite loop

Here is a live test. it keeps resizing in a infinite loop why is happening?
It is really urgent.

Thanks

http://www.orbitlab.gr/beta/test/

this is the code

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<krpano onstart="showtext(Try to resize the browser, infostyle);"> 

	<!-- use only a grid preview pano to save download space ;-) -->
	<preview type="grid(cube,50,50,400,0xCCCCCC,0x999999,0xFFFFFF);" details="16" />

	<view hlookat="-15" vlookat="-10" fov="80" fovmin="50" fovmax="150" maxpixelzoom="off" />

	<textstyle name="infostyle"
	   		origin="center" edge="center" textalign="center" background="false" border="false"
	   		fontsize="40" textcolor="0xFFFFFF" bold="false" effect="glow(0xFFFFFF,0.7,4,2);glow(0x000000,1,4,2);dropshadow(3,45,0x000000,2,0.6);"
	   		showtime="5" fadetime="1.0"
	   		/>

	<!-- Events where the actions needed to set the area and the border are called  -->			   
	<events onresize="set_area_size();" 
			onenterfullscreen="reset_area_size();"
			onexitfullscreen="set_area_size();"
			/>
	
	<style name="buttonstyle" url="%SWFPATH%/plugins/textfield.swf" children="false"
	   	visible="false" width="150" height="22"
	   	css="p{color:#000000; font-family:Arial; font-weight:bold; font-size:14; margin-left:5; margin-right:5; text-align:center; }" 
	   	backgroundcolor="0xFFFFFF" roundedge="5" shadow="1" borderwidth="0" glow="4" glowcolor="0xFFFFFF" 
	   	onover="tween(alpha,0.7,distance(0.3,0.2));" 
	   	onout="tween(alpha,1.0,distance(0.3,0.2));" 
	   	onloaded="set(alpha,0);set(textblur,15);set(blur,15); set(visible,true); tween(alpha,1,0.3); tween(textblur,0,0.3); tween(blur,0,0.3);"
	   	/>
	
	<plugin name="set_area" keep="true" style="buttonstyle"
			html="[p]set_area[/p]"
			align="bottom" x="-170" y="25"
			onclick="set_area_size();"
			/>
	
	<plugin name="reset_area" keep="true" style="buttonstyle"
			html="[p]reset_area[/p]"
			align="bottom" x="0" y="25"
			onclick="reset_area_size();"
			/>
	
	<plugin name="border" keep="true" style="buttonstyle"
			html="[p]set border[/p]"
			align="bottom" x="170" y="25"
			onclickBorderFalse="set(area_vars.border.value,false); reset_border(); set(plugin[border].onclick,get(onclickBorderTrue)); set(plugin[border].html,'[p]border = false[/p]');"
			onclickBorderTrue="set(area_vars.border.value,true); set_border(); set(plugin[border].onclick,get(onclickBorderFalse)); set(plugin[border].html,'[p]border = true[/p]');"
			onclick="set(area_vars.border.value,false); reset_border();	set(plugin[border].onclick,get(onclickBorderTrue)); set(plugin[border].html,'[p]border = false[/p]');"
			/>

	<!--  area border  -->
	<plugin name="border_top"	url="border_x2.png" enabled="false" align="top"	width="100%"  accuracy="1" /> 
	<plugin name="border_bottom" url="border_x2.png" enabled="false" align="bottom" width="100%"  accuracy="1" />
	<plugin name="border_left"   url="border_x2.png" enabled="false" align="left"   height="100%" accuracy="1" /> 
	<plugin name="border_right"  url="border_x2.png" enabled="false" align="right"  height="100%" accuracy="1" />
	
	<!-- define variables to set the area -->	
	<area_vars>
		<image_width  value="500"  />
		<image_height value="200"  />
		<margin   	value="30"   />
		<border   	value="true" />
	</area_vars>

	<!-- actions to set the area   	-->
	<action name="set_area_size">
		set(events.onresize,'set_area_size();');
		div(aspect,get(area_vars.image_width.value),get(area_vars.image_height.value));
		set(dest_area_x,get(area_vars.margin.value));
		mul(temp_val,dest_area_x,2); sub(dest_area_width,stagewidth,get(temp_val));
		div(dest_area_height,dest_area_width,aspect);
		sub(temp_val,stageheight,dest_area_height); div(dest_area_y,get(temp_val),2);
		if(dest_area_y LT dest_area_x, set(dest_area_y,get(area_vars.margin.value)); 
			mul(temp_val,dest_area_y,2); sub(dest_area_height,stageheight,get(temp_val));
			mul(dest_area_width,dest_area_height,aspect); 
			sub(temp_val,stagewidth,dest_area_width); div(dest_area_x,get(temp_val),2); , );
		set(area.x, 0);
		set(area.y, 0);
		set(area.width, get(stagewidth));
		set(area.height, get(stageheight));
		tween(area.x, get(dest_area_x));
		tween(area.y, get(dest_area_y));
		tween(area.width, get(dest_area_width));
		tween(area.height, get(dest_area_height),,,WAIT);
		if( area_vars.border.value == true, set_border(););
	</action>
	<action name="reset_area_size">
		set(events.onresize,); 
		tween(area.x, 0);
		tween(area.y, 0);
		tween(area.width, get(stagewidth));
		tween(area.height, get(stageheight),,,WAIT);
		set(area.x, 0%);
		set(area.y, 0%);
		set(area.width, 100%);
		set(area.height, 100%);
		if( area_vars.border.value == false, reset_border(););
	</action>

	<!-- action to set the area border -->	
	<action name="set_border"> 
		set(plugin[border_top].visible,true);
		set(plugin[border_bottom].visible,true);
		set(plugin[border_left].visible,true); 
		set(plugin[border_right].visible,true); 
	</action>

	<!-- action to reset the area border -->	
	<action name="reset_border">
		set(plugin[border_top].visible,false);
		set(plugin[border_bottom].visible,false);
		set(plugin[border_left].visible,false); 
		set(plugin[border_right].visible,false); 
	</action>

</krpano>

2

Dienstag, 13. Juli 2010, 17:20

Hi,

you are calling several tween actions that change the area size and position INSIDE the resize event,
but each change after the onresize event will again result in a call of the onresize event of course,
therefore the onresize event...

what do you want to achieve?

best regards,
Klaus

3

Dienstag, 13. Juli 2010, 17:28

I'd like to resize the area with a tween effect everytime my browser is resized.

4

Donnerstag, 15. Juli 2010, 15:51

do you mean a delayed tween resize to the resized-size?

5

Donnerstag, 15. Juli 2010, 17:38

yes exactly. Could you give me some help.

6

Freitag, 16. Juli 2010, 10:12

hmm, sorry, that's not that easy as I first thought...
whats the sense behind that?

best regards,
Klaus