Locale (mx.lang.Locale)


Object
    |
    +-mx.lang.Locale

public class Locale
extends Object

The mx.lang.Locale class allows you to control how multilanguage text is displayed in a SWF file. The Flash Strings panel allows you to use string IDs instead of string literals in dynamic text fields. This allows you to create a SWF file that displays text loaded from a language-specific XML file. The XML file must use the XML Localization Interchange File Format(XLIFF). There are three ways to display the language-specific strings contained in the XLIFF files:

You can use the properties and methods of this class when you want to replace the string IDs "via ActionScript at runtime."

All of the properties and methods available are static, which means that they are accessed through the mx.lang.Locale class itself rather than through an instance of the class.

Note: The Locale class is different from the other classes in the ActionScript 2.0 Language Reference, since it is not part of the Flash Player. Since this class installed in the Flash Authoring classpath it is automatically compiled into your SWF files. Using the Locale class increases the SWF size slightly since the class is compiled into the SWF.

Availability: ActionScript 2.0; Flash Player 7

Property summary

Modifiers

Property

Description

static

autoReplace:Boolean

Determines whether strings are replaced automatically after loading the XML file.

static

languageCodeArray:Array [read-only]

An array containing language codes for the languages that have been specified or loaded into the FLA file.

static

stringIDArray:Array [read-only]

An array containing all the string IDs in the FLA file.

Properties inherited from class Object

constructor, __proto__, prototype, __resolve


Method summary

Modifiers

Signature

Description

static

addDelayedInstance(instance:Object, stringID:String) : Void

Adds the {instance, string ID} pair into the internal array for later use.

static

addXMLPath(langCode:String, path:String) : Void

Adds the {languageCode and languagePath} pair into the internal array for later use.

static

checkXMLStatus() : Boolean

Returns true if the XML file is loaded; false otherwise.

static

getDefaultLang() : String

The default language code as set in the Strings panel dialog box or by calling the setDefaultLang() method.

static

initialize() : Void

Automatically determines the language to use and loads the XML language file.

static

loadLanguageXML(xmlLanguageCode:String, customXmlCompleteCallback:Function) : Void

Loads the specified XML language file.

static

loadString(id:String) : String

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

static

loadStringEx(stringID:String, languageCode:String) : String

Returns the string value associated with the given string ID and language code.

static

setDefaultLang(langCode:String) : Void

Sets the default language code.

static

setLoadCallback(loadCallback:Function) : Void

Sets the callback function that is called after the XML file is loaded.

static

setString(stringID:String, languageCode:String, stringValue:String) : Void

Sets the new string value of a given string ID and language code.

Methods inherited from class Object

addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch



Version 8

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00002347.html