03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

greeting_txt.text = Locale.loadString("IDS_GREETING");<br />

loadString (Locale.loadString method)<br />

public static loadString(id:String) : String<br />

Returns the string value associated with the given string ID in the current language.<br />

Availability: <strong>ActionScript</strong> <strong>2.0</strong>; Flash Player 7<br />

Parameters<br />

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

Returns<br />

String - The string value associated with the given string ID in the current language.<br />

Example<br />

The following example uses an interval to check every 10 milliseconds to see if the language<br />

file has successfully loaded. Once the XML file has loaded, the greeting_txt text field<br />

instance on the Stage is populated with the IDS_GREETING string from the XML language file.<br />

import mx.lang.Locale;<br />

Locale.setLoadCallback(localeCallback);<br />

Locale.load<strong>Language</strong>XML("en");<br />

// create interval to check if language XML file is loaded<br />

var locale_int:Number = setInterval(checkLocaleStatus, 10);<br />

function checkLocaleStatus():Void {<br />

if (Locale.checkXMLStatus()) {<br />

clearInterval(locale_int);<br />

trace("clearing interval @ " + getTimer() + " ms");<br />

}<br />

}<br />

// callback function for Locale.setLoadCallback()<br />

function localeCallback(success:Boolean):Void {<br />

greeting_txt.text = Locale.loadString("IDS_GREETING");<br />

}<br />

See also<br />

loadStringEx (Locale.loadStringEx method)<br />

loadStringEx (Locale.loadStringEx method)<br />

public static loadStringEx(stringID:String, languageCode:String) : String<br />

Locale (mx.lang.Locale) 747

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!