Expressions and Operators

Expressions are statements in the language that use expression operators to evaluate to a single resulting value. The resulting value could be assigned to a object variable or used as part of a conditional flow control statement.

The following is an example of an expression using numeric variables:

$script.subtotal = 14

$script.taxRate = .07

$script.shippingFees = 27

$script.taxes = $script.subtotal * $script.taxRate

$script.total = $script.subtotal + $script.taxes + $script.shippingFees

In this case, all of the expression operators used, “*” (multiply) and “+” (add), evaluate as expressions with numeric results.

There are three categories of expressions in Action Script. These categories correspond to the four basic variable types: string expressions (string), Boolean expressions (Boolean) and numeric expressions (float and integer).

Expressions use variable auto-conversion rules when working with variables in the expression.  Depending on the expression operator, the operator may define the auto-conversion rule to the types of variables may determine the type of auto-conversion to occur.

In addition to object variables, object variable methods and object methods can be used in expressions. It is expected that the method will return a value.

Boolean Operators

Concatenation Operator

Equality Operators

Numeric Operators

Plus Operator