1 Reply Latest reply on Jul 3, 2007 9:45 PM by doug777

    NumberFormat

    MyronCope Level 1
      I need to use NumberFormat to format a currency: biggest question is how do i import it? someone please give me a sample import line because i need to know the namespace.

      I have examples in my actionscript cookbook on how to use the currencyFormat() function but I need to know the import line. thanks much.
        • 1. Re: NumberFormat
          doug777 Level 1
          You can use myNumber.toFixed(2) to return a string with the number of decimal places equal to the number in brackets.

          If you need something more complex, you can do this:

          import mx.formatters.NumberFormatter;

          var myFormat:NumberFormatter = new NumberFormatter();
          myFormatter.precision = 2;//see Class NumberFormatter for other properties
          var myFormattedNumber:String = myFormatter.format(myNumber);

          Doug