Actionscript 3 Flex mx:CurrencyFormatter格式不正确
当我使用下面的格式化程序时,我得到了错误的值Actionscript 3 Flex mx:CurrencyFormatter格式不正确,actionscript-3,apache-flex,mxml,Actionscript 3,Apache Flex,Mxml,当我使用下面的格式化程序时,我得到了错误的值 <mx:CurrencyFormatter id="currencyFormatter" currencySymbol="" precision="2" rounding="up" decimalSeparatorFrom="," decimalSeparatorTo="," useNegativeSign="true"
<mx:CurrencyFormatter
id="currencyFormatter"
currencySymbol=""
precision="2"
rounding="up"
decimalSeparatorFrom=","
decimalSeparatorTo=","
useNegativeSign="true"
useThousandsSeparator="true"
thousandsSeparatorFrom="."
thousandsSeparatorTo="."
alignSymbol="left" />
例如,如果我传递值1.5,则format方法的结果为“15,00”。
有人知道这里发生了什么吗?Tks我发现了问题:
在我的代码中,我尝试这样做:
currencyFormatter.format(item.total.toString())
我决定删除toString方法,如下所示:
currencyFormatter.format(item.total)
如果我将值“1.5”作为字符串传递给格式化程序,则得到“15,00”作为结果。
但如果我将值“1.5”作为一个数字传递,则得到正确的格式(“1,50”)