You are not logged in.

nelk

Intermediate

  • "nelk" started this thread

Posts: 358

Location: Paris

  • Send private message

1

Tuesday, September 22nd 2009, 3:38pm

use the add command

Hi,

I think there was a thread on this, but I can't find it anymore.

I'd like to move a plugin 10 pixel down.

Is it possible actually ?

I tried :

Source code

1
add(plugin[button].y,get(plugin[button].y),10)


and

Source code

1
add(plugin[button].y,plugin[button],10)


unsuccessfully. *cry*
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

2

Tuesday, September 22nd 2009, 3:56pm

Hi nelk,

I think you can do it this way:

Source code

1
2
add(dest,get(plugin[button].y),10);
set(plugin[button].y,dest);


more info about add() here: krpano 1.0.8 beta 7

Salut.

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

3

Tuesday, September 22nd 2009, 4:21pm

Hi,

The code above does not work... *sad*
It seems that the add() action work well but the variable dest into set(plugin[button].y,dest); seems to not be "passed" correctly. *confused*

Source code

1
2
3
add(dest,get(plugin[button].y),10);
trace(dest);
set(plugin[button].y,dest);


I do not know why... Sorry... *sad*

Somebody knows the correct way to "pass a variable" as value to a set() action?

Salut.

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

4

Tuesday, September 22nd 2009, 6:34pm

Hi,

Really strange things... *attention*

After many tries, I reach these conclusions:
  • It seems that the add(dest,get(plugin[button].y),10); action works well.
  • Doing trace(dest); it gives back the correct value.
  • The set(plugin[button].y,dest); does not do the job correctly. It seems that it set the "y" value to 0, null or NaN....
  • But, doing trace(get(plugin[button].y)); it gives back the correct value. *attention* *blink*
So, I really do not understand what it is happening here *blink* *wacko* *confused* ... If some one can explain it will be very appreciated. *thumbup*

You can try it using this code:

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
<krpano version="1.0.7" >

<style name="buttonstyle"
   url="%SWFPATH%/plugins/textfield.swf" children="false"
   width="120" 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" 
   visible="false" 
   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="pluginToMove" keep="true" style="buttonstyle"
    html="[p]move Y by 10[/p]"
    align="bottom" x="0" y="250"
    onclick="action(move);"
/>

<action name="move">
add(dest,get(plugin[pluginToMove].y),10);
trace(dest);
set(plugin[pluginToMove].y,dest);
trace(get(plugin[pluginToMove].y));
</action>

</krpano>


Salut.

This post has been edited 1 times, last edit by "michel" (Sep 23rd 2009, 7:50am)


michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

5

Tuesday, September 22nd 2009, 9:58pm

Hi nelk,

I get it... *tongue* The set(plugin[button].y,dest); must be set(plugin[button].y,get(dest));
Doing this way, all works as expected...

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
<krpano version="1.0.8" >

	<style name="buttonstyle"
	   	url="%SWFPATH%/plugins/textfield.swf" children="false"
	   	width="120" 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" 
	   	visible="false" 
	   	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="pluginToMove" keep="true" style="buttonstyle"
	    	html="[p]move Y by 10[/p]"
	    	align="bottom" x="0" y="250"
	    	onclick="action(move);"
			/>
			
	<action name="move">
	    	add(dest,get(plugin[pluginToMove].y),10);
	    	trace(dest);
	    	set(plugin[pluginToMove].y,get(dest));
	    	trace(get(plugin[pluginToMove].y));
	</action>
	
</krpano>


But then I do not understand why, when I use set(plugin[button].y,dest); , trace(get(plugin[button].y)); gives back the correct value. *attention* *blink*

Salut.

6

Thursday, September 24th 2009, 9:51am

But then I do not understand why, when I use set(plugin[button].y,dest); , trace(get(plugin[button].y)); gives back the correct value. *attention* *blink*
Hi,

trace() works a bit tricky

trace looks up the given text if there is a variable with this name and then traces the content of it,
and only if there is no variable it traces the given text,

e.g. it will be resolved in this way:
1. trace(get(plugin[button].y));
2. trace(dest);
3. trace(>>value of dest<<);

best regards,
Klaus

nelk

Intermediate

  • "nelk" started this thread

Posts: 358

Location: Paris

  • Send private message

7

Sunday, September 27th 2009, 7:59pm

Thanks for your comments, and for your test michel !! :-)

"dest" is a particular variable ? or it can be everything else ?
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

8

Sunday, September 27th 2009, 9:26pm

Hi nelk,

dest is only a name for the variable ... it can be anything else you like to name your variable. ;-)

Source code

1
2
3
4
5
6
<action name="move">
    add(new_variable,get(plugin[pluginToMove].y),10);
    trace(new_variable);
    set(plugin[pluginToMove].y,get(new_variable));
    trace(get(plugin[pluginToMove].y));
</action>


Salut.

nelk

Intermediate

  • "nelk" started this thread

Posts: 358

Location: Paris

  • Send private message

9

Monday, September 28th 2009, 9:24am

Thanks michel,

You know, there is so many variable in the 1.0.8 which is not documented (except in some thread in this forum) so I prefer to ask to be sure ! :-)
VideoStitch, a video stitching engine / blog sur les visites virtuelles ( french ).