How can I put Locale.loadString("IDS_001") into button.label
I am retrieving the Locale from the system, and need to place the fields of the Array into their respective places.
One of these being for example,
IDS_001
This works, and returns what I'd probably expect. Although why it returns multiple instances I can't yet figure.
public var vIDS_001:String;
Locale.autoReplace = true;
var localeName:String = LocaleID.DEFAULT;
var nf:StringTools = new StringTools(localeName);
trace("Actual local ID: " + nf.actualLocaleIDName);
var defLang:String = nf.actualLocaleIDName;
trace( "Last Operation Status: " + nf.lastOperationStatus );
Locale.setDefaultLang(defLang);
Locale.setLoadCallback(localeCallback);
//Locale.addXMLPath("defLang", "../en/PinPointPremium_en.xml");
Locale.addXMLPath("defLang", "../" + defLang + "/PinPointPremium_" + defLang + ".xml");
function localeCallback(success:Boolean) {
if (success) {
// trace(Locale.stringIDArray); // IDS_GREETING
trace(Locale.loadString("IDS_001"));
var vIDS_001 = (Locale.loadString("IDS_001"));
trace("+++" + vIDS_001);
} else {
trace("unable to load XML");
}
}
Actual local ID: en-GB Last Operation Status: noError PinPoint the Entered Address +++PinPoint the Entered Address PinPoint the Entered Address +++PinPoint the Entered Address Test Movie terminated.
This is the button code, and I'm trying to figure out how to get that IDS_001 information into the btnGPS.label. No matter what I try, it errors out
btnGPS = new Button();
btnGPS.width = stage.stageWidth - 20;
btnGPS.height = 25;
btnGPS.x = 10;
btnGPS.alpha = 0.9;
// btnGPS.label = "PinPoint My Current Location";
btnGPS.setStyle("textFormat", btnFormat);
btnGPS.y = stage.stageHeight - 46;
btnGPS.addEventListener(MouseEvent.CLICK, btnGPSMouseClickHandler);
addChild(btnGPS);
None of these following work in place of the original
//btnGPS.label = Locale.loadString("IDS_001");
//btnGPS.label = IDS_001;
//btnGPS.label = vIDS_001;
Theoretically, loading the Locale XML file should populate the occurences of IDS_001 - but I'm totally lost now. Been looking at this for a few days and now can't see the real picture. Does anyone have any idea how I solve this please ... I know this is so simple, but I can't get it.
thanks
