Flash Lite 2.x and 3.0 ActionScript Language Reference

-= 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.

Operands

expression1 : Number - A number or expression that evaluates to a number.

expression2 : Number - A number or expression that evaluates to a number.

Returns

Number - The result of the arithmetic operation.

Example

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 

See also

- subtraction operator