In the Designer, it is possible to define variables that are local within an action script. These local variables are only known within the current action script.
Syntax
local nameOfLocalVariable = <expression>;
Semantics
Declaring a local variable having the same type as the expression.
Substitutables
nameOfLocalVariable
Any given name.
expression
Expressions are object accessors, operation calls, boolean expressions, literals, etc.
Examples
local endPosition = myArray.count();
local myObject = anotherObject.myObject;
local mylocalinteger = 1;
local myLocalString = "empty String";
local anotherLocalString = myObject.myName;
This enables the compiler to apply static type checking without requiring the modeler to put the static types into the action script.
Local Variables of Complex Type
Using local, you can also create complex local variables by deriving the type from a given object.
Syntax
create local nameOfLocalVariable using typeOf(expression);
Semantics
Creates a local variable of complex type usable within the action script.
Substitutables
nameOfLocalVariable
Any given name.
expression
Any valid action script expression that can be evaluated to a type.
Examples
create local tmp using typeOf(myObject.myAttribute);
Local Arrays
Using local, you can also create a local array. The type of the array elements is derived from an expression.
Syntax
create local array nameOfLocalArray using typeOf(expression);
Semantics
Creates a local array using the array element declared after the equal sign.
Substitutables
nameOfLocalArray
Any given name.
expression
Any valid action script expression that can be evaluated to a type. This is then the type of the array element.
Examples
create local array myArray using typeOf(myObject.myAttribute[1]);