Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > Math > abs (Math.abs method) | |||
public static abs(x:Number) : Number
Computes and returns an absolute value for the number specified by the parameter x.
Availability: ActionScript 1.0; Flash Player 5 - In Flash Player 4, the methods and properties of the Math class are emulated using approximations and might not be as accurate as the non-emulated math functions that Flash Player 5 supports.
x:Number - A number.
Number - A number.
The following example shows how Math.abs() returns the absolute value of a number and does not affect the value of the x parameter (called num in this example):
var num:Number = -12; var numAbsolute:Number = Math.abs(num); trace(num); // output: -12 trace(numAbsolute); // output: 12
Flash CS3