Flex NumberFormatter 数值的格式化

时间:2023-11-12 22:59:14
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
<fx:XML id="myData" xmlns="">
<root>
<forsale>
<item name="weight" value="32.5658"/>
</forsale>
</root>
</fx:XML>
<mx:NumberFormatter id="fmtNumber" precision="2" rounding="nearest"/>
</fx:Declarations>
<s:Label text="Weight {fmtNumber.format(myData.forsale.item.@value)}千克"/>
</s:Application>

rouding 属性是舍入法

Flex NumberFormatter 数值的格式化

Flex NumberFormatter 数值的格式化