Formatting data with the formatter classes : Formatter « Data Model « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Data Model » FormatterScreenshots 
Formatting data with the formatter classes
Formatting data with the formatter classes
    
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
    <mx:Script>
        
            private function calculate(event:Event):void
            {               
                var result:Number = Number(priceTxt.text(Number(ivaTxt.text100);
                totalTxt.text = totalF.format(result.toString());               
            }
            
      
    </mx:Script>
    
    <mx:CurrencyFormatter id="totalF" 
        currencySymbol=""
        precision="2"
        decimalSeparatorFrom=","
        decimalSeparatorTo=","
        thousandsSeparatorFrom="."
        thousandsSeparatorTo="."
        useThousandsSeparator="true" />
    
    <mx:Panel title="Formatter" width="477" height="252">
        <mx:Form>
            <mx:TextInput id="priceTxt"/>
            <mx:TextInput id="ivaTxt"/>
            <mx:FormItem label="">
                <mx:Button label="Calculate" click="calculate(event)" />
            </mx:FormItem>
            
        </mx:Form>
        
        <mx:ControlBar>
        
            <mx:Label text="This is your value: " />                
            <mx:TextInput id="totalTxt"  editable="false"/>
            
        </mx:ControlBar>
        
    </mx:Panel>
    
</mx:Application>

   
    
    
    
  
Related examples in the same category
1.Formatter ErrorFormatter Error
2.Data Formatting Using MXML FormattersData Formatting Using MXML Formatters
3.Edit Event FormatterEdit Event Formatter
4.End Edit Event FormatterEnd Edit Event Formatter
5.Set up the formatters.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.