loadString (Locale.loadString method)

public static loadString(id:String) : String

Returns the string value associated with the given string ID in the current language.

Availability: ActionScript 2.0; Flash Player 7

Parameters

id:String - The identification (ID) number of the string to load.

Returns

String - The string value associated with the given string ID in the current language.

Example

The following example uses an interval to check every 10 milliseconds to see if the language file has successfully loaded. Once the XML file has loaded, the greeting_txt text field instance on the Stage is populated with the IDS_GREETING string from the XML language 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");
}

See also

loadStringEx (Locale.loadStringEx method)