2009
07.26

Flex: How to parse number when using NumberFormatter

By Satish Natarajan

Suppose you are using a NumberFormatter like this

<mx:NumberFormatter id=”numberFormatter” precision=”2″
useThousandsSeparator=”true” useNegativeSign=”false”/>

….

<mx:TextInput id=”input_item”  text=”{numberFormatter.format(value)}” />

….

<mx:NumberValidator source=”{input_item}” property=”text” integerError=”Enter valid number”
minValue=”0″ domain=”real” precision=”2″
valid=”{value = parseFloat(nb.parseNumberString((input_item.text)));}”/>

…..

<mx:Script>
<![CDATA[

import mx.formatters.NumberBase;
public var nb:NumberBase = new NumberBase();

]]>
</mx:Script>

Leave a comment if you need help understanding…


2009
07.26

Flex: Two way binding to a variable to a TextInput

By Satish Natarajan

<mx:TextInput id="example" text="{source}" valueCommit="{source = example.text;}" />