Data Model Flex


    
    xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"
    creationComplete="initApp(event)"
    chromeColor="{resourceManager.getUint('FormattingValues', 'CHROMECOLOR')}">
    
        
    

    
                    formatString="{resourceManager.getString('FormattingValues', 'DATE_FORMAT')}" />
                    formatString="{resourceManager.getString('FormattingValues', 'TIME_FORMAT')}" />
                    precision="{resourceManager.getInt('FormattingValues', 'CURRENCY_PRECISION')}"
            currencySymbol="{resourceManager.getString('FormattingValues', 'CURRENCY_SYMBOL')}"
            thousandsSeparatorTo="{resourceManager.getString('FormattingValues','THOUSANDS_SEPARATOR')}"
            decimalSeparatorTo="{resourceManager.getString('FormattingValues','DECIMAL_SEPARATOR')}" />
    

     
        import mx.resources.ResourceBundle; 
        [Bindable] 
        private var locales:Array = [ "es_ES","en_US" ]; 
        [Bindable] 
        private var dateValue:String; 
        [Bindable] 
        private var timeValue:String; 
        [Bindable] 
        private var currencyValue:String; 
        private var d:Date = new Date(); 
        private function initApp(e:Event):void { 
            localeComboBox.selectedIndex = locales.indexOf(resourceManager.localeChain[0]); 
            applyFormats(e); 
            // Updating the localeChain does not reapply formatters. As a result, you must 
            // apply them whenever the ResourceManager's change event is triggered. 
            resourceManager.addEventListener(Event.CHANGE, applyFormats); 
        } 
        private function comboChangeHandler():void { 
            // Changing the localeChain property triggers a change event, so the 
            // applyFormats() method will be called whenever you select a new locale. 
            resourceManager.localeChain = [ localeComboBox.selectedItem ]; 
        } 
        private function applyFormats(e:Event):void { 
            dateValue = dateFormatter.format(d); 
            timeValue = timeFormatter.format(d); 
            currencyValue = currencyFormatter.format(1000); 
        } 
      

    
        [ResourceBundle("FormattingValues")] 
    

            change="comboChangeHandler()" />