Search code examples
actionscript-3apache-flexflex4flex3

How to retain two decimal points in flex using Math.round()


How to retain two decimal points in flex using Math.Round

code:

txtTotal.text=Math.round((Number(txtRate.text)*Number(txtQuantity.text))).toString();

here the rate is a constant 1.1 and quantity is variable ie rate*quantity=1.1 * quantity


Solution

  • Instead of .toString(), use .toFixed(2);