EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 228

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
228 Chapter 12: ActionScript Dictionary
Example
The pre-decrement form of the operator decrements x to 2 (x - 1 = 2), and returns the result
as
y:
x = 3;
y = --x;
//y is equal to 2
The post-decrement form of the operator decrements x to 2 (x - 1 = 2), and returns the original
value of
x as the result y:
x = 3;
y = x--
//y is equal to 3
++ (increment)
Availability
Flash Player 4.
Usage
++expression
expression++
Parameters
None.
Returns
A number.
Description
Operator (arithmetic); a pre-increment and post-increment unary operator that adds 1 to
expression. The expression can be a variable, element in an array, or property of an object.
The pre-increment form of the operator (
++expression) adds 1 to expression and returns the
result. The post-increment form of the operator (
expression++) adds 1 to expression and
returns the initial value of
expression (the value prior to the addition).
The pre-increment form of the operator increments
x to 2 (x + 1 = 2), and returns the result
as
y:
x = 1;
y = ++x
//y is equal to 2
The post-increment form of the operator increments x to 2 (x + 1 = 2), and returns the original
value of
x as the result y:
x = 1;
y = x++;
//y is equal to 1

Table of Contents

Related product manuals