ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > Locale (mx.lang.Locale) > loadLanguageXML (Locale.loadLanguageXML method) | |||
Loads the specified XML language file.
Availability: ActionScript 2.0; Flash Player 8
xmlLanguageCode:String - The language code for the XML language file that you want to load.
customXmlCompleteCallback:Function - Custom callback function to call when XML language file loads.
The following example uses the loadLanguageXML() method to load the English (en) XML language file. Once the language file loads, the localeCallback() method is called and populates the greeting_txt text field on the Stage with the contents of the IDS_GREETING string in the XML file.
import mx.lang.Locale;
Locale.setLoadCallback(localeCallback);
Locale.loadLanguageXML("en");
// create interval to check if language XML file is loaded
var locale_int:Number = setInterval(checkLocaleStatus, 10);
function checkLocaleStatus():Void {
if (Locale.checkXMLStatus()) {
clearInterval(locale_int);
trace("clearing interval @ " + getTimer() + " ms");
}
}
// callback function for Locale.setLoadCallback()
function localeCallback(success:Boolean):Void {
greeting_txt.text = Locale.loadString("IDS_GREETING");
}
|
|
|
|