If you just need rounding to a fixed number of decimal places, and you don't need formatting, you could use the toFixed() method of the Number class. ASDoc example:

 
var num:Number = 7.31343;
trace(num.toFixed(3)); // Output: 7.313
 
- Gordon

 

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Darin Kohles
Sent: Thursday, August 24, 2006 10:35 AM
To: [email protected]
Subject: [flexcoders] Re: Limiting decimal places

 

Use a Currency Formatter:

// import the class
import mx.formatters.CurrencyFormatter;

// in code create and instance and set the format (also include $|,|.
selection)
var cashFormatter:CurrencyFormatter = new CurrencyFormatter();
cashFormatter.precision=2;

// apply the format to the raw and save
productPrice.text = cashFormatter.format(productObj.retailprice);

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to