Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript language elements > Operators > -= subtraction assignment operator | |||
expression1 -= expression2
Assigns expression1 the value of expression1- expression2. For example, the following two statements are equivalent: x -= y ;x = x - y;
String expressions must be converted to numbers; otherwise, NaN (not a number) is returned.
Availability: ActionScript 1.0; Flash Player 4
expression1 : Number - A number or expression that evaluates to a number.
expression2 : Number - A number or expression that evaluates to a number.
Number - The result of the arithmetic operation.
The following example uses the subtraction assignment (-=) operator to subtract 10 from 5 and assign the result to the variable x:
var x:Number = 5; var y:Number = 10; x -= y; trace(x); // output: -5
The following example shows how strings are converted to numbers:
var x:String = "5"; var y:String = "10"; x -= y; trace(x); // output: -5
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00001306.html