|
|
Quellcode |
1 2 3 4 5 6 7 8 9 |
<action name="callhelp">
var helpvis = get(plugin[helptext].visible);
if (helpvis == "false") {
set(plugin[helptext].visible,true);
}
else {
set(plugin[helptext].visible,false);
}
</action>
|
|
|
Quellcode |
1 2 3 |
<action name="callhelp"> set(plugin[helptext].visible,true); </action> |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »magnus« (17. September 2009, 21:34)
Download krpano 1.0.8 beta
Zitat
Edit: I am using the 1.0.7 demo for testing.
|
|
Quellcode |
1 |
if(plugin[helptext].visible EQ true, set(plugin[helptext].visible,false);, set(plugin[helptext].visible,true);); |
|
|
Quellcode |
1 2 3 4 |
<action name="callhelp"> set(helpvis,get(plugin[helptext].visible)); if(helpvis == false, set(plugin[helptext].visible,true);, set(plugin[helptext].visible,false;); </action> |
Yes, but there is a missing ) into the code:
Zitat
As I need the variable the full action would have to look like this:
........
|
|
Quellcode |
1 2 3 4 |
<action name="callhelp"> set(helpvis,get(plugin[helptext].visible)); if(helpvis == false, set(plugin[helptext].visible,true);, set(plugin[helptext].visible,false);); </action> |
the math values are always floats (="Number" in AS3),Next part to find out is how to realize basic mathematic operations with my variables, in case the variable is an int, float whatever. And how to call actions with parameters.
|
|
Quellcode |
1 |
actionname(parameter1,parameter2); |
|
|
Quellcode |
1 2 3 4 |
<action name="actionname">
trace('parameter1=', %1);
trace('parameter2=', %2);
</action>
|
|
|
Quellcode |
1 |
actionname( get(view.hlookat), get(view.vlookat) ); |
|
|
Quellcode |
1 2 3 4 5 6 7 |
<action ="moveplugin"> <!-- %1 = nameoftextfield --> set(txtwidth, get(plugin[%1].width)); sub(newx, txtwidth, 20); set(plugin[%1].x, newx); </action> |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »magnus« (24. September 2009, 17:20)
to pass the content of variables to an action use get() on the action call,
e.g.
![]()
Quellcode
1 actionname( get(view.hlookat), get(view.vlookat) );
the get() will be resolved before calling, and then the values will be passed to the action,
|
|
Quellcode |
1 2 3 4 5 6 7 |
<action ="moveplugin"> <!-- %1 = nameoftextfield --> set(txtwidth, get(plugin[%1].width)); sub(newx, txtwidth, 20); set(plugin[%1].x, get(newx);); </action> |
|
|
Quellcode |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<action name="addclose"> <!-- %1 = nameoftextfield --> set(txtheight, get(plugin[%1].height)); set(txtwidth, get(plugin[%1].width)); div(htxtwidth, txtwidth, 2); sub(newx, htxtwidth, 20); sub(newy, txtheight, 20); showtext(get(newx)); addplugin(%1_close); set(plugin[%1_close].url, buttons/close.gif); set(plugin[%1_close].origin, center); set(plugin[%1_close].zorder, 2000); set(plugin[%1_close].x, get(newx)); set(plugin[%1_close].y, get(newy)); set(plugin[%1_close].onclick, "action(closetxt, %1);"); </action> |
|
|
Quellcode |
1 |
showtext(get(newx)); |
|
|
Quellcode |
1 |
showtext(get(newx);); |
|
|
Quellcode |
1 |
set(plugin[%1_close].x, get(newx)); |
|
|
Quellcode |
1 |
set(plugin[%1_close].x, get(newx);); |
):|
|
Quellcode |
1 |
set(plugin[%1_close].x, get(newx)); |
I have tried your code and it work perfectly....
Zitat
Here is the full script I am working on. It adds a close button to the top right corner of a textfield, at least that it what it is supposed to do. (The maths is a little of at the moment.)
|
|
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 |
<krpano version="1.0.7">
<view fisheyefovlink="1.5" />
<preview type="grid(cube,32,32,256,0x000000,0x778899,0x000000);" details="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="button1" style="buttonstyle" align="lefttop" x="10" y="10"
html="[p]Close 1[/p]" onclick="action(addclose,button1);"/>
<plugin name="button2" style="buttonstyle" align="righttop" x="10" y="10"
html="[p]Close 2[/p]" onclick="action(addclose,button2);"/>
<action name="addclose">
<!-- %1 = nameoftextfield -->
set(txtheight, get(plugin[%1].height));
set(txtwidth, get(plugin[%1].width));
div(htxtwidth, txtwidth, 2);
sub(newx, htxtwidth, 20);
sub(newy, txtheight, 20);
showtext(get(newx));
trace('get(newx) = ',get(newx));
addplugin(%1_close);
set(plugin[%1_close].url, buttons/close.gif);
set(plugin[%1_close].origin, center);
set(plugin[%1_close].zorder, 2000);
set(plugin[%1_close].x, get(newx));
set(plugin[%1_close].y, get(newy));
set(plugin[%1_close].onclick, "action(closetxt, %1);");
</action>
</krpano>
|
Instead of using showtext(get(newx)); to trace your variable, you can use the trace() action as you can see in the code above... this way you can trace what you want pressing the o key to pop up the krpano debugger.
Zitat
I added the showtext to test if my variables are ok. What I ran into is that it has to be