Hi,
here an example:
the action:
|
Quellcode
|
1
2
3
4
5
6
|
<action name="example">
trace('the name of the action is: %0');
trace('the first argument: %1');
trace('the second argument: %2');
trace('the third argument: %3');
</action>
|
now there two ways to call this action:
1.
action(name-of-the-action, arguments...);
e.g.
|
Quellcode
|
1
|
...onclick="action(example, abc, 123, xyz);"
|
2. or since 1.0.8 beta 8 - direct, without "action()" =
name-of-the-action(arguments...);
|
Quellcode
|
1
|
...onclick="example(abc, 123, xyz);"
|
internally it works like this:
- the CONTENT of the called action is loaded as string
(<action>THIS-IS-THE-CONTENT</action>)
- then the %0, %1, %2, ... placeholders are REPLACED with the given arguments
e.g. this:
|
Quellcode
|
1
2
3
4
|
trace('the name of the action is: %0');
trace('the first argument: %1');
trace('the second argument: %2');
trace('the third argument: %3');
|
will become this:
|
Quellcode
|
1
2
3
4
|
trace('the name of the action is: example');
trace('the first argument: abc');
trace('the second argument: 123');
trace('the third argument: xyz');
|
- then these actions are parsed and executed
to pass the CONTENT of variables to an action - get(var) - can be used (also since 1.0.8 beta 8)
get(var) can currently only be used inside arguments (for any action)
e.g.
|
Quellcode
|
1
|
...onclick="example(get(view.hlookat), get(view.vlookat), get(view.fov));"
|
this will become in the first step: (example values)
|
Quellcode
|
1
|
...onclick="example(100.123, 5.253, 90.0);"
|
and then in the next step the action will be called with these values,
best regards,
Klaus