Faster yet ... sample below

define the formatters:
======================
<mx:NumberFormatter id="numberFormatter" useNegativeSign="true"/>
<mx:NumberFormatter id="percentFormatter" useNegativeSign="true" precision="2"/>
<mx:DateFormatter id="shortDateDisplay" formatString="MM/DD/YYYY"/>
<mx:CurrencyFormatter id="currencyFormatter"  precision="2" rounding="nearest" 
/>


Use in your code:
=================
txtCurrentBalance.text = currencyFormatter.format(account.currentCashBalance);

txtGainPct.text = percentFormatter.format((gain / account.initialCashBalance) * 
100);



--- In [email protected], "stuarthuss" <huss.stu...@...> wrote:
>
> You can use Flex Framework formatter classes, for a demonstration on how to 
> use them check out the short (6 mins) video "Formatting Data" from Adobe's 
> Flex in a week tutorial [ http://www.adobe.com/devnet/flex/videotraining/ ] 
> It's on Day 3.
> 
> --- In [email protected], "christophe_jacquelin" 
> <christophe_jacquelin@> wrote:
> >
> > Hello,
> > 
> > I want that a TextInput to have always the same format : 000/000 with 0 
> > replacing by different numbers.
> > 
> > How to force a TextInput to be in a given format ? 
> > 
> > Thank you,
> > Christophe,
> >
>


Reply via email to