xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark"
creationComplete="initApp()">
import mx.resources.ResourceBundle;
import mx.controls.Alert;
[Bindable]
private var locales:Array = [ "es_ES","en_US" ];
private function initApp():void {
/* Initialize the ComboBox to the first locale in the locales Array. */
localeComboBox.selectedIndex = locales.indexOf(resourceManager.localeChain[0]);
}
private function registrationComplete():void {
Alert.show(resourceManager.getString('RegistrationForm', 'thanks'));
}
private function comboChangeHandler():void {
/* Set the localeChain to either the one-element Array
[ "en_US" ] or the one-element Array [ "es_ES" ]. */
resourceManager.localeChain = [ localeComboBox.selectedItem ];
}
private function createReplacementBundle():void {
var newRB:ResourceBundle = new ResourceBundle("en_US", "RegistrationForm");
newRB.content["registration_title"] = "Registration Form";
newRB.content["submit_button"] = "Submit This Form";
newRB.content["personname"] = "Enter Your Name Here:";
newRB.content["street_address"] = "Enter Your Street Address Here:";
newRB.content["city"] = "Enter Your City Here:";
newRB.content["state"] = "Enter Your State Here:";
newRB.content["zip"] = "Enter Your ZIP Code Here:";
resourceManager.addResourceBundle(newRB);
resourceManager.update();
}
[ResourceBundle("RegistrationForm")]
change="comboChangeHandler()" />
label="{resourceManager.getString('RegistrationForm','personname')}">
label="{resourceManager.getString('RegistrationForm','street_address')}">
label="{resourceManager.getString('RegistrationForm','submit_button')}"
click="registrationComplete()" />