displaying precision value.... in flex text box
in my flex application im retrieving a data from database..... (ie开发者_StackOverflow) price as decimal(18,4)...
Now i need to display the retrieved value in an flex text box
textbox name is price.text... obj is object name...
i have used the following in code...it not works...
price.text = obj.Price.toPrecision((18,4));
.kindly give ur suggestions folks....
Take a look at the NumberFormatter
. To follow your example, you would declare a NumberFormatter
like so:
<mx:NumberFormatter
id="myNumberFormatter"
precision="4"/>
or in Actionscript:
var myNumberFormatter:NumberFormatter = new NumberFormatter;
myNumberFormatter.precision = 4;
Then use the NumberFormatter
's format function on your value:
price.text = myNumberFormatter.format(obj.Price);
精彩评论