The following example uses the comma (,) operator without the parentheses () operator and
illustrates that the comma operator sequentially evaluates all of the expressions but returns the
value of the first expression. The second expression,
one.
var v:Number = 0;
var z:Number = 0;
v = v + 4 , z++, v + 6;
trace(v); // output: 4
trace(z); // output: 1
The following example is identical to the previous example except for the addition of the
parentheses () operator and illustrates once again that, when used with the parentheses ()
operator, the comma (,) operator returns the value of the last expression in the series:
var v:Number = 0;
var z:Number = 0;
v = (v + 4, z++, v + 6);
trace(v); // output: 6
trace(z); // output: 1
See also
() parentheses operator
add concatenation (strings) operator
string1 add string2
Deprecated since Flash Player 5. Macromedia recommends that you use the add (
when creating content for Flash Player 5 or later. This operator is not supported in Flash
Player 8 or later.
Concatenates two or more strings. The add (+) operator replaces the Flash 4
Player 4 files that use the
for string concatenation when brought into the Flash 5 or later authoring environment. Use
the add (+) operator to concatenate strings if you are creating content for Flash Player 4 or
earlier versions of the Player.
Availability: ActionScript 1.0; Flash Player 4
Operands
- A string.
string1 : String
- A string.
string2 : String
154
ActionScript language elements
operator are automatically converted to use the add (+) operator
&
, is evaluated and
z++
is incremented by
z
) operator
+
operator; Flash
&
Need help?
Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?