Hi,
there are more possibilities to do this:
1. change the onclick function:
- there are 2 actions
- one action for closeing
- and one action for opening
- in every action the onclick funtion is set to the other action
example xml - a button to show and hide a infoscreen:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
<action name="showinfo">
set(plugin[button].onclick,action(hideinfo));
set(plugin[info].enabled,true);
set(plugin[info].visible,true);
tween(plugin[info].alpha,1.0,distance(1.0,0.2),easeOutQuart);
</action>
<action name="hideinfo">
set(plugin[button].onclick,action(showinfo));
set(plugin[info].enabled,false);
tween(plugin[info].alpha,0.0,distance(1.0,0.2),easeOutQuart,set(plugin[info].visible,false));
</action>
<plugin name="button" ....
onclick="action(showinfo);"
/>
|
2. use the new IF function: (1.0.8 beta 4 or higher)
- use some of the existing variable (e.g. visible or enabled)
- or create a own variable (e.g. state)
- check this variable and decide what to do
xml example:
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<plugin name="button" ... state="closed"
onclick="if( state == closed , action( openaction ), action( closeaction) );"
/>
<action name="openaction">
set(plugin[button].state, opened);
set(plugin[info].visible,true);
</action>
<action name="closeaction">
set(plugin[button].state, closed);
set(plugin[info].visible,false);
</action>
|
best regards,
Klaus