/ Published in: ActionScript 3
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* 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, as specified in the fractionDigits parameter. The valid range for the fractionDigits parameter is from 0 to 20. Specifying a value outside this range throws an exception. */ var num:Number = 4; trace(num.toFixed(2)); // 4.00 var num:Number = 7.31343; trace(num.toFixed(3)); // 7.313