Loadstring (Locale.loadstring Method) - MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE Reference

Actionscript 2.0 language reference
Table of Contents

Advertisement

Example
The following example uses the
language file. Once the language file loads, the
populates the
greeting_txt
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");
}

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
- The identification (ID) number of the string to load.
id:String
Returns
- The string value associated with the given string ID in the current language.
String
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
instance on the Stage is populated with the
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);
738
ActionScript classes
loadLanguageXML()
localeCallback()
text field on the Stage with the contents of the
IDS_GREETING
method to load the English (en) XML
method is called and
greeting_txt
string from the XML language file.
IDS_GREETING
text field

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents

Save PDF