开发者

displaying precision value.... in flex text box

开发者 https://www.devze.com 2023-03-04 03:03 出处:网络
in my flex application im retrieving a data from database..... (ie开发者_StackOverflow) price as decimal(18,4)...

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消