Mega Code Archive
Set up the formatters
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")]