use the add command
-
-
-
Hi,
The code above does not work...
It seems that the add() action work well but the variable dest into set(plugin[button].y,dest); seems to not be "passed" correctly.I do not know why... Sorry...
Somebody knows the correct way to "pass a variable" as value to a set() action?
Salut.
-
Hi,
Really strange things...
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.
So, I really do not understand what it is happening here ... If some one can explain it will be very appreciated.
You can try it using this code:
Code
Display More<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.
-
Hi nelk,
I get it... The set(plugin[button].y,dest); must be set(plugin[button].y,get(dest));
Doing this way, all works as expected...Code
Display More<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.
Salut.
-
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.
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 -
Thanks for your comments, and for your test michel !!
"dest" is a particular variable ? or it can be everything else ?
-
Hi nelk,
dest is only a name for the variable ... it can be anything else you like to name your variable.
Code<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.
-
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 !
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!