MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference page 139

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Operands
expression1 :
Number
expression2 :
Number
expressionN :
Number
Returns
- The value of
Object
Example
The following example uses the comma (,) operator in a
for (i = 0, j = 0; i < 3 && j < 3; i++, j+=2) {
trace("i = " + i + ", j = " + j);
}
// Output:
// i = 0, j = 0
// i = 1, j = 2
The following example uses the comma (,) operator without the parentheses () operator and
illustrates that the comma operator returns only the value of the first expression without the
parentheses () operator:
var v:Number = 0;
v = 4, 5, 6;
trace(v); // output: 4
The following example uses the comma (,) operator with the parentheses () operator and
illustrates that the comma operator returns the value of the last expression when used with the
parentheses () operator:
var v:Number = 0;
v = (4, 5, 6);
trace(v); // output: 6
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
- An expression to be evaluated.
- An expression to be evaluated.
- Any number of additional expressions to be evaluated.
,
expression1
expression2
, and so on.
loop:
for
, is evaluated and
z++
is incremented by
z
Operators
139

Advertisement

Table of Contents
loading

Table of Contents