Thursday, November 21, 2013

Flex Samples: About toFixed method of the Number class in Flex


About toFixed method of the Number class in Flex


Returns a string representation of the number in fixed-point notation. Fixed-point notation means that the string will contain a specific number of digits after the decimal point
The following example shows how toFixed(3) returns a string that rounds to three decimal places.
var num:Number = 7.31343;
trace(num.toFixed(3)); // 7.313

The following example shows how toFixed(2) returns a string that adds trailing zeroes.
var num:Number = 4;
trace(num.toFixed(2)); // 4.00

1 comment: