XenoGuard Documentation

Variable

Actions » Programming » Identifier » Variable

The action Define Variable creates a new variable. The variable name must be chosen uniquely. It can consist of any character (digits, letters and special characters) and may also contain spaces, which increases readability. Variables are defined by default in the Local Context, so they are valid only within the ActionScript. The Global Context allows access to all action scripts.

Information The variable name must be chosen uniquely in the selected context.
[-] Hide
  1. Open the Programming node in the Workspace Explorer.
  2. Open the Identifier node, select the Variable action.

Parameters:

The action has the following input parameters:

name Description
Context Scope
Defines the range of validity of the variable.

Allowed Context Scopes
 [Fixed]
Accepted Values [Local, Global]
Name
The variable name.
Read Only
Specifies whether the variable can be changed or not.
Static Specifies whether the last variable value is retained after exiting the ActionScript (static) or the initial value is reset when the script is re-entered.
Data Type
The data type of the variable.

Allowed Context Scope [Fixed]
Possible data types [Text, Number, Unsigned Number, Floating Point, Boolean, Image]
Value
The initial value of the variable.

Example 1 (Display values of local variables):

This example creates two local variables, Car Type and Model, with Text and Number as its data type, respectively. The Values of the variables are then output in Write Text.

Example 2 (Use a Global variable in another ActionScript):

This example creates a global variable Tax Rate with Floating Point as its data type and two local variables, Item Name and Item Price with Text and Floating Point as data types, respectively. The value of the created global variable is then used in another ActionScript to calculate the sales tax and display the output in Write Text.

This ActionScript uses a created global variable:

See also identifier operations:

Parameter
Result
Enum
Set Identifier