Using Operators To Manipulate Values In Expressions - MACROMEDIA FLASH MX 2004-USING ACTIONSCRIPT IN FLASH Use Manual

Using actionscript in flash
Hide thumbs Also See for FLASH MX 2004-USING ACTIONSCRIPT IN FLASH:
Table of Contents

Advertisement

Using operators to manipulate values in expressions

An expression is any statement that Flash can evaluate and that returns a value. You can create an
expression by combining operators and values or by calling a function.
Operators are characters that specify how to combine, compare, or modify the values of an
expression. The elements that the operator performs on are called operands. For example, in the
following statement, the addition (
the variable
;
foo
foo + 3
This section describes general rules about common types of operators, operator precedence, and
operator associativity:
"Operator precedence and associativity" on page 49
"Numeric operators" on page 51
"Comparison operators" on page 52
"String operators" on page 53
"Logical operators" on page 53
"Bitwise operators" on page 54
"Equality operators" on page 54
"Assignment operators" on page 55
"Dot and array access operators" on page 56
For information on these operators, as well as special operators that don't fall into these categories,
see Chapter 2, "ActionScript Language Reference" in Flash ActionScript Language Reference.
Operator precedence and associativity
When two or more operators are used in the same statement, some operators take precedence over
others. ActionScript follows a precise hierarchy to determine which operators to execute first. For
example, multiplication is always performed before addition; however, items in parentheses [()]
take precedence over multiplication. So, without parentheses, ActionScript performs the
multiplication in the following example first:
total = 2 + 4 * 3;
The result is 14.
But when parentheses surround the addition operation, ActionScript performs the addition first:
total = (2 + 4) * 3;
The result is 18.
operator adds the value of a numeric literal to the value of
+)
and
are the operands:
foo
3

Using operators to manipulate values in expressions

49

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents