What is Software? | What is Education? | What is Technology? | What is Research? | What is Wi-Fi? | What is Communication? | What is Customer Service?

Free SEO Tutorials & Help

Tutorials:   Adobe Flash   Adobe Photoshop   CorelDRAW   SEO  

Site Map

Website Development | Cable & Broadband Magazine | Solutions for Higher Education | Auction Anything Online

Adobe Flash Help & Tutorials

 Back to Topics

 

How to Create Multilanguage Text in Flash

Selecting an encoding language

Unicode and Adobe Flash Player

About using preloaders with screen-based documents

Text encoding in Flash Player

Unicode encoding formats supported by Flash Player

About encoding in external XML files

About fonts for Unicode-encoded text

Using embedded fonts

XML font embedding table

Font set selections

Authoring multilanguage text with the Strings panel

Selecting languages for translation

Adding strings to the Strings panel

Changing the language displayed on the Stage

About editing strings in the Strings panel

Publishing and deploying multilanguage text

Manually replacing strings at publish time using the Stage language

Using automatic language detection with the default language

sing custom language detection

XML file format

XLIFF examples

Exported XML file sample

Translating text in the Strings panel or an XML file

Importing an XML file into the Strings panel

Creating documents with multilanguage text without using the Strings panel

Using the XMLConnector component to connect to external XML files

Using a Western keyboard to enter Asian characters on the Stage

Using ActionScript to load external files

Creating documents with multilanguage text using the #include action

Creating documents with multilanguage text using text variables

Using external text or XML files that are not Unicode-encoded

Selecting an encoding language

TOP

All text in a computer is encoded as a series of bytes. Many different forms of encoding (and therefore, different bytes) represent text. Different kinds of operating systems use different kinds of encoding for text. For example, Western Windows operating systems usually use CP1252 encoding; Western Macintosh operating systems usually use MacRoman encoding; Japanese Windows and Macintosh systems usually use Unicode encoding.

Unicode can encode most languages and characters used throughout the world. The other forms of text encoding used by computers are subsets of the Unicode format, tailored to specific regions of the world. Some of these forms are compatible in some ranges and incompatible in other ranges, so using the correct encoding is critical.

Unicode comes in several forms. Flash Player versions 6 and 7 support text or external files in the 8-bit Unicode format UTF-8, and in the 16-bit Unicode formats UTF-16 BE (Big Endian) and UTF-16 LE (Little Endian).

 

Unicode and Adobe Flash Player

TOP

Macromedia Flash Player 6 and later supports Unicode text encoding. Any user with Flash Player 6 or later can view multilanguage text, regardless of the language used by the operating system running the player, if they have the correct fonts installed.

Flash Player assumes that all external text files associated with a Flash Player application are Unicode encoded, unless you tell the player otherwise. If you use external text files that are not Unicode encoded, you can set the system.useCodepage property to true to tell Flash Player to use the traditional code page of the operating system running the player. For more information, see Using external text or XML files that are not Unicode-encoded.

For Flash applications in Macromedia Flash Player 5 or earlier that are authored in Flash MX or earlier, Flash Player 6 and earlier versions display the text using the traditional code page of the operating system running the player.

About using preloaders with screen-based documents

TOP

If you want to include a preloader (a separate SWF file that loads your primary SWF) with your screen-based document, one way to do this is to create the preloader as a separate SWF file (non-screen-based), and load the SWF file for the screen-based document from within the preloader SWF.

You cannot create a preloader within a screen-based document, because all screens in a document are located on the first frame of the root Timeline, so you cannot call or load other frames.

 

Text encoding in Flash Player

TOP

By default, Flash Player 7 and later assumes that all text it encounters is Unicode encoded. If your document loads external text or XML files, the text in these files should be UTF-8 encoded. You can create these files using the Strings panel or in a text or HTML editor, such as Macromedia Dreamweaver, that can save the files in Unicode format.

Flash Player 7 and later supports the 8-bit Unicode format UTF-8, and the 16-bit Unicode formats UTF-16 BE (Big Endian) and UTF-16 LE (Little Endian).

 

Unicode encoding formats supported by Flash Player

TOP

When reading text data in Flash, Flash Player looks at the first two bytes in the file to detect a byte order mark (BOM), a standard formatting convention used to identify the Unicode encoding format. If no BOM is detected, the text encoding is interpreted as UTF-8 (an 8-bit encoding format). It is recommended that you use UTF-8 encoding in your applications.

If Flash Player detects either of the following BOMs, the text encoding format is interpreted as follows:

If the first byte of the file is OxFE and the second is OxFF, the encoding is interpreted as UTF-16 BE (Big Endian). This is used for Macintosh operating systems.

If the first byte of the file is OxFF and the second is OxFE, the encoding is interpreted as UTF-16 LE (Little Endian). This is used for Windows operating systems.

Most text editors that can save files in UTF-16BE or LE automatically add the BOMs to the files.

NOTE : If you set the system.useCodepage property to true, the text is interpreted using the traditional code page of the operating system that is running the player; it is not interpreted as Unicode. For more information, see Using external text or XML files that are not Unicode-encoded.

 

About encoding in external XML files

TOP

You cannot change the encoding of an XML file by changing the encoding tag. Flash Player identifies the encoding of an external XML file using the same rules as for all external files: If no BOM is encountered at the beginning of the file, the file is assumed to be in UTF-8 encoding. If a BOM is encountered, the file is interpreted as UTF-16BE or LE.

 

About fonts for Unicode-encoded text

TOP

When you use external files that are Unicode encoded, your users must have access to fonts containing all the glyphs used in your text files. By default, Flash stores the names of fonts used in dynamic or input text files. During SWF file playback, Flash Player 7 (and earlier versions) looks for those fonts on the operating system running the player.

If the text in a SWF file contains glyphs that are not supported by the specified font, both Flash Player 7 and Flash Player 8 attempt to locate a font on the user's system that supports those glyphs. It is not always possible for the player to locate an appropriate font. The behavior of this function depends on the fonts available on the user's system as well as on the operating system running Flash Player.

 

Using embedded fonts

TOP

You can embed fonts for dynamic or input text fields. However, some fonts, particularly those used for Asian languages, can add significantly to the SWF file size when embedded. With Flash Basic 8 and Flash Professional 8, you can select ranges of fonts you want to embed.

You can also embed fonts by creating a font symbol in the library. For more information on this technique, see Creating font symbols.

To select and embed a range of fonts:

  1. On the Stage, select a text field, and then show the Property inspector (Window > Properties).

  2. Click the Embed button to display the Character Embedding dialog box.

  3. Select the range of font sets you want to embed by doing any of the following:

    • Click on a character set in the Character Set text field.

    • Select multiple ranges by Shift-clicking the first and last fonts of a continguous range of fonts, or by Control-clicking (Windows) or Command-clicking (Macintosh) to select noncontiguous fonts.

    • Click the Auto Fill button.

    • The size of each font group appears in parentheses next to the font name. As you select multiple font sets, the panel shows the total number of glyphs you selected.

      NOTE : For example, to embed Chinese and Western characters, you would need to select Chinese and Western font sets. Select only the font sets you want to embed, so you do not exceed the internal maximum number of glyphs for the authoring tool (approximately 65.500). If you select more than the maximum, a warning dialog box appears.

  4. Click OK.

    If you exceed the internal maximum number of glyphs for the authoring tool, a warning dialog box appears.

    NOTE : Flash does not perform error-checking to confirm that glyphs actually exist in the font for the selected character set. During the actual publish or export procedure, only glyphs that are present in the font are embedded in the SWF file.

To embed font sets from text on the Stage:

  1. Select the text on the Stage.

  2. In the Property inspector (Window > Properties), click the Character button to show the Character Embedding dialog box.

  3. Select the character sets you want to embed.

  4. Click the AutoFill button.

  5. Click OK.

    The glyphs for the selected fonts are embedded.

To remove embedded font sets:

  1. On the Stage, select a text field, and then show the Property inspector (Window > Properties).

  2. Click the Embed button to display the Character Embedding dialog box.

  3. Click the Don't Embed button to remove all of the embedded fonts.

  4. Click OK to close the dialog box, or select other fonts sets that you want to embed in the SWF file.

 

XML font embedding table

TOP

The list of selected fonts is stored and maintained as an external XML file and resides in the user configuration folder. It is named Unicode_Table.xml and contains the one-to-many relationship between a particular language and all the necessary Unicode glyph ranges as shown in the following Korean examples.

The font set groupings are based upon the Unicode Blocks as defined by the Unicode Consortium. They are organized in Flash in a manner that makes selection quick and easy. To provide a simpler workflow, when you select a particular language, all related glyph ranges are embedded even if they are scattered into disjointed groupings.

For example, if you select Korean, the following Unicode character ranges are embedded.

3131-318E Hangul symbols

3200-321C Hangul specials

3260-327B Hangul specials

327F-327F Korean symbol

AC00-D7A3 Hangul symbols

If you select Korean + CJK, a larger font set is embedded:

3131-318E Hangul symbols

3200-321C Hangul specials

3260-327B Hangul specials

327F-327F Korean symbol

4E00-9FA5 CJK symbols

AC00-D7A3 Hangul symbols

F900-FA2D CJK symbols

 

Font set selections

TOP

The following table gives more details about each font set selection:

 

Range

Description

Uppercase [A-Z]

Basic Latin uppercase glyphs

Lowercase [a-z]

Basic Latin lowercase glyphs

Numerals [0-9

Basic Latin numeral glyphs

Punctuation [!@#%...]

Basic Latin punctuation

Basic Latin

Basic Latin glyphs within the Unicode range 0x0021 to 0x007E

Japanese Kana

Hiragana and Katakana glyphs (including half-width forms)

Japanese Kanji - Level 1

Japanese Kanji characters

Japanese (All)

Japanese Kana and Kanji (including punctuation and special characters)

Basic Hangul

Most commonly used Korean characters, Roman characters, punctuations, and special characters/symbols

Hangul (All)

11,720 Korean characters (sorted by Hangul syllables), Roman characters, punctuations, and special characters/symbols)

Traditional Chinese - Level 1

5000 most commonly used Traditional Chinese characters used in Taiwan

Traditional Chinese (All)

All Traditional Chinese characters used in Taiwan and Hong Kong, and punctuations

Simplified Chinese - Level 1

6000 most commonly used Simplified Chinese characters used in mainland of China and punctuations

Chinese (All)

All Traditional and Simplified Chinese characters and punctuations

Thai

All Thai glyphs

Devanagari

All Devanagari glyphs

Latin I

Latin-1 Supplement range 0x00A1 to 0x00FF (including punctuation, superscripts and subscripts, currency symbols, and letterlike symbols)

Latin Extended A

Latin Extended-A range 0x0100 to 0x01FF (including punctuation, superscripts and subscripts, currency symbols, and letterlike symbols)

Latin Extended B

Latin Extended-B range 0x0180 to 0x024F (including punctuation, superscripts and subscripts, currency symbols, and letterlike symbols)

Latin Extended Add'l

Latin Extended Additional range 0x1E00 to 0x1EFF (including punctuation, superscripts and subscripts, currency symbols, and letterlike symbols)

Greek

Greek and Coptic, plus Greek Extended (including punctuation, superscripts and subscripts, currency symbols, and letterlike symbols)

Cyrillic

Cyrillic (including punctuation, superscripts and subscripts, currency symbols, and letterlike symbols)

Armenian

Armenian plus ligatures

Arabic

Arabic plus Presentation Forms-A and Presentation Forms-B

Hebrew

Hebrew plus Presentation Forms (including punctuation, superscripts and subscripts, currency symbols, and letterlike symbols)

 

Authoring multilanguage text with the Strings panel

TOP

The Strings panel lets you create and update multilingual content. You can specify content for text fields that span multiple languages, and have Flash automatically determine the content that should appear in a certain language based on the language of the computer running Flash Player.

The following steps describe the general work flow:

  1. Author a FLA file in one language. Any text that you want to enter in another language must be in a dynamic or input text field.

  2. In the Strings panel Settings dialog box, select the languages you want to include and select one of them as the default language.

  3. After you select a language, a column for the language is added to the Strings panel. When you save, test, or publish the application, a folder with an XML file is created for each language. For more information, see Selecting languages for translation.

  4. In the Strings panel, encode each text string with an ID. For more information, see Adding strings to the Strings panel.

  5. Publish the application.

  6. A folder is created for each language you select, and within each language folder is an XML file for that language. For more information, see Publishing and deploying multilanguage text.

  7. Send the published FLA file and XML folders and files to your translators. You can author in your native language, and let them make the translation. They can use translation software directly in the XML files or in the FLA file. Translating text in the Strings panel or an XML file.

  8. When you receive the translations from your translators, import the translated XML files back into the FLA file. For more information

 

Selecting languages for translation

TOP

You can select as many as 100 languages that can appear on the Stage and in the Strings panel for translation. Each language you select becomes a column in the Strings panel. You can change the Stage language to show the text on the Stage in any of the languages you selected. The selected language appears when you publish or test the file.

When selecting languages, you can use any of the languages provided in the pop-up menu as well as any other Unicode-supported language.

To select a language:

  1. Select Window > Other Panels > Strings to open the Strings panel.

  2. Click the Settings button to show the Settings dialog box.

  3. Add a language by doing one of the following:

    • In the Languages text box, highlight a language you want to select, and click the Add button.

    • If the language does not appear in the Languages text box, in the blank field below the Languages text box, type a language code in the format xx (The the language code is from ISO 639-1.) Then click the Add button.

    After you click the Add button, the language appears in the Active Languages field.

  4. Repeat step 3 until you have added all the languages you want.

  5. Select a default language from the Default runtime language pop-up menu. This language appears on systems that do not have one of the active languages you selected.

  6. If you want to load an XML file for the languages from a different URL at runtime, type the URL in the URL text field.

  7. Click OK.

  8. A column for each selected language appears in the Strings panel. The columns appear in alphabetical order.

  9. Save the FLA file. When you save the FLA file, a folder for each language you selected is created in the same folder indicated in the SWF publish path. If no SWF publish path has been selected, it is created in the folder the FLA file resides in. Within each language file an XML file is created that is used to load translated text.

To remove a language:

  1. Select Window > Other Panels > Strings to open the Strings panel.

  2. Click the Settings button to show the Settings dialog box.

  3. In the Active languages field, highlight a language you want to remove, and click the Remove button.

    The language no longer appears in the Active languages field.

  4. Repeat step 3 until you have removed all the languages you want.

  5. When you are done removing languages, click OK.

    The column for each removed language no longer appears in the Strings panel.

    NOTE : When you remove a language from the Strings panel, the language XML file is not deleted from the local file system. This lets you add the language back into the Strings panel using the previous XML file, and prevents accidental deletion. To completely remove the language, you must delete or replace the language XML file.

 

Adding strings to the Strings panel

TOP

There are several ways to assign text strings to the Strings panel: you can assign a string ID to a dynamic or input text field, add a string to the Strings panel without assigning it to a text field, or assign an existing string ID to an existing dynamic or input text field. For information about creating dynamic and input text boxes, see Creating text.

To assign a string ID to a text field:

  1. Select Window > Other Panels > Strings to open the Strings panel.

  2. Select the Text tool from the toolbar. On the Stage, create an input or dynamic text field.

  3. While the text field is selected, enter a unique ID in the ID field in the Strings panel.

    NOTE : If a static text field is selected on the Stage, the Stage text selection section on the Strings panel displays the message "Static text cannot have an ID associated with it." If a nontext item is selected or multiple items are selected, it shows the message "Current selection cannot have an ID associated with it."

  4. In the Strings panel, type the string in the String text field.

  5. Click Apply to add the string to the Strings panel.

    NOTE : You can also press Shift+Enter to apply the ID to the text field.

To add a string ID to the Strings panel without assigning it to a text field:

  1. Select Window > Other Panels > Strings to open the Strings panel.

  2. Type in a new string ID and new string in the Strings panel, and click the Apply button.

    NOTE : You can also press Shift+Enter to apply the ID to the text field.

  3. When you are ready to assign the new string to a text field, perform the steps in the following procedure.

To assign an existing ID to a text field:

  1. Select the Text tool from the toolbar. On the Stage, create an input or dynamic text field.

  2. Type the name of an existing ID in the ID section of the Strings panel.

  3. Click Apply.

    The String text field on the Stage appears with the text string assigned to the ID.

    NOTE : You can press Shift+Enter to apply the ID to the text field, or just Enter if the focus is on the ID field.

 

Changing the language displayed on the Stage

TOP

You can change the language that appears on the Stage to any of the active languages you selected.

To display the text on the Stage in another language:

Select Window > Other Panels > Strings to open the Strings panel.

In the Stage Language pop-up menu, select the language you want to use for the Stage language. This must be a language you added as an available language.

After you change the Stage language, any new text you type on the Stage appears in that language. If you have previously entered text strings for the language in the Strings panel, any text on the Stage appears in the selected language. If not, the text fields already on the Stage are blank.

 

About editing strings in the Strings panel

TOP

After you have entered text strings in the Strings panel, you can edit the text strings in the following ways:

You can edit the text strings directly in the Strings panel cells.

You can edit the text strings on the Stage in the language selected as the Stage language, using features such as find and replace and spelling checking. Text that is changed using these features is changed on the Stage and in the Strings panel.

You can edit the XML file directly. For more information, see Translating text in the Strings panel or an XML file.

 

Publishing and deploying multilanguage text

TOP

When you save, publish, or test the FLA file, a folder with an XML file is created for each available language you selected in the Strings panel. The default location for the XML folders and files is the same folder indicated as the SWF publish path. For more information. If no SWF publish path has been selected, the XML folder and files are saved in the folder in which the FLA file is located. For example, if you have a file named Test in the mystuff folder, and you have selected English (en), German (de), and Spanish (es) as active languages, and you have not selected a SWF publish path, when you save the FLA file, the following folder structure is created:

\mystuff\Test.fla
\mystuff\de\Test_de.xml
\mystuff\en\Test_en.xml
\mystuff\es\Test_es.xml


When you deploy a SWF file, you also need to deploy the associated XML files with the string translations in the web server. The first frame that contains text cannot appear until the entire XML file is downloaded.

 

Manually replacing strings at publish time using the Stage language

TOP

You can choose to manually replace strings when you publish your Flash SWF file using the Stage language. This replaces all instances of input and dynamic text with an associated string ID using the Stage language. In this case, text strings are only updated when you publish the SWF file; language detection is not automatic, and you must publish a SWF file for each language that you want to support.

To manually replace strings at publish time:

  1. Select Window > Other Panels > Strings to open the Strings panel.

  2. Click the Settings button to display the Settings dialog box.

  3. Select the Replace Strings Automatically at Runtime check box.

  4. Click OK

    All instances of input and dynamic text are replaced with the translated strings when you publish your SWF file.

 

Using automatic language detection with the default language

TOP

You can change the default runtime language to any language that you have selected as an available language. When automatic language detection is turned on, and the SWF file is viewed on the language operating system platform, the default language is used on any system that is set to a language that is not one of the active languages. For example, if you set your default language to English, and if you selected ja, en, and fr as active languages, users who have their system language set to Japanese, English, or French automatically see text strings in their language. However, users who have their system language set to Swedish, which is not one of the selected languages, automatically see text strings in the default language you selected--in this case, English.

To select the default language and automatic language detection:

  1. Select Window > Other Panels > Strings to open the Strings panel.

  2. Click the Settings button to display the Settings dialog box.

  3. In the Default language pop-up menu, select the language you want to use for the default language. This must be a language you have added as an available language.

  4. If you want to enable automatic language detection, make sure that the Replace Strings Automatically at Runtime check box is selected.

  5. Click OK

    Flash generates the following ActionScript, which stores the language XML file paths. You can use this as a starting point for your own language detection script.

    NOTE : The ActionScript generated by the Strings panel does not use the Locale.initialize function. You must decide how to call this function based on the language detection customizations your project requires.

import mx.lang.Locale;
Locale.setFlaName("<flaFileName>");
Locale.setDefaultLang("langcode");
Locale.addXMLPath("langcode", "url/langcode/flaname_langcode.xml");

 

sing custom language detection

TOP

If you are an advanced Flash developer with knowledge of ActionScript, you can invoke text replacement at a time that you designate, by creating your own custom component, or using ActionScript to access the language XML files. For example, you might create a pop-up menu that lets users select the language of their choice to view content.

For information on writing ActionScript to create custom language detection, see About the Strings panel in Working with Text and Strings in Learning ActionScript 2.0 in Flash.

To select custom language detection:

  1. Select Window > Other Panels > Strings to open the Strings panel.

  2. Click the Settings button to display the Settings dialog box.

  3. In the Default Language pop-up menu, select the language you want to use for the default language. This must be a language you have added as an available language.

  4. Select the Replace Strings via ActionScript check box.

  5. Click OK.

    Flash generates the following ActionScript, which stores the language XML file paths. You can use this as a starting point for your own language detection script.

    NOTE : The ActionScript generated by the Strings panel does not use the Locale.initialize function. You must decide how to call this function based on the language detection customizations your project requires.

    import mx.lang.Locale;
    Locale.setFlaName("<flaFileName>");
    Locale.setDefaultLang("langcode");
    Locale.addXMLPath("langcode", "url/langcode/flaname_langcode.xml");.

 

XML file format

TOP

Exported XML is in UTF-8 format and follows the XML Localization Interchange File Format (XLIFF)1.0 standard. It defines a specification for an extensible localization interchange format that lets any software provider produce a single interchange format that can be delivered to, and understood by, any localization service provider.

 

XLIFF examples

TOP

If any of the following characters are entered in the Strings panel, they are replaced by the appropriate entity reference when written to XML files:

Character

Replaced by

&

&amp;

'

&apos;

"

&quot;

<

&lt;

>

&gt;

 

Exported XML file sample

TOP

The following samples show what an XML file generated by the Strings panel looks like in the source language--in this example, English--and in another language--in this example, French:

English source version sample

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xliff PUBLIC "-//XLIFF//DTD XLIFF//EN"
"http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" >
<xliff version="1.0" xml:lang="en">
<file datatype="plaintext" original="MultiLingualContent.fla" source-language="EN">
    <header></header>
    <body>
      <trans-unit id="001" resname="IDS_GREETINGS">
        <source>welcome to our web site!</source>
      </trans-unit>
      <trans-unit id="002" resname="IDS_MAILING LIST">
        <source>Would you like to be on our mailing list?</source>
      </trans-unit>
      <trans-unit id="003" resname="IDS_SEE YOU">
        <source>see you soon!</source>
      </trans-unit>
      <trans-unit id="004" resname="IDS_TEST">
        <source></source>
      </trans-unit>
    </body>
  </file>
</xliff>

French version sample

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xliff PUBLIC "-//XLIFF//DTD XLIFF//EN"
"http://www.oasis-open.org/committees/xliff/documents/xliff.dtd" >
<xliff version="1.0" xml:lang="fr">
<file datatype="plaintext" original="MultiLingualContent.fla" source-language="EN">
    <header></header>
    <body>
      <trans-unit id="001" resname="IDS_GREETINGS">
        <source>Bienvenue sur notre site web!</source>
      </trans-unit>
      <trans-unit id="002" resname="IDS_MAILING LIST">
        <source>Voudriez-vous être sur notre liste de diffusion?</source>
      </trans-unit>
      <trans-unit id="003" resname="IDS_SEE YOU">
        <source>A bientôt!</source>
      </trans-unit>
      <trans-unit id="004" resname="IDS_TEST">
        <source></source>
      </trans-unit>
    </body>
  </file>
</xliff>
 
Translating text in the Strings panel or an XML file

TOP

After you finish authoring your document, have assigned IDs to all the text in the Strings panel and selected all the languages into which you want to translate the document, you can send it to translators. When sending files to translators, you need to include not only the FLA file but also the folders for the XML files and the XML file for each language.

Translators can either work directly in the language columns in the Strings panel or work in the XML files for each language to translate the FLA file to selected languages. If you translate directly in the XML file, you must either import the XML file to the Strings panel or save it in the default directory for that language.

To translate text in the Strings panel:

  1. Select Window > Other Panels > Strings to open the Strings panel.

  2. For each language to be translated, select the appropriate language column, then type the translated text for that language to be associated with each string ID.

  3. To show the text on the Stage in the language you selected, select the language in the Stage Language field.

  4. When you are finished, save, publish, or test the file.

    All XML files for all languages are overwritten with the information in the Strings panel.

    NOTE : If you want to preserve the translation in an XML file, save it in a different folder.

To translate text in an XML file:

  1. Using an XML file editor or translating software, open the folder for the desired language, then the XML file for that language. The XML file is populated with the IDs for each text string.

  2. Enter the text string for the language next to the ID.

  3. If necessary, import the translated XML file into the Strings panel.

 

Importing an XML file into the Strings panel

TOP

After you modify an XML file, if you place it in the folder specified in the Strings panel for that language, the XML file is loaded into the FLA file when it opens.

You can also import an XML file into the Strings panel from another location. After you import it, when you save, test, or publish the file, the XML file in the folder specified for that language is overwritten. You cannot import an XML file for a language unless it has already been selected as an available language in the Strings panel. You can also add a language and import an XML file with the translation for that language.

To import an XML file into the Strings panel:

  1. Select Window > Other Panels > Strings to open the Strings panel.

  2. Click Import XML to show the Import XML dialog box.

  3. In the Select a Language pop-up menu, select the language of the XML file you are importing, and click OK.

  4. Navigate to the folder and XML file to import.

    The XML information is loaded into the column in the Strings panel for the language you selected in step 3.

    NOTE : Be sure to select the same language in Steps 3 and 4. Otherwise, you could, for example, import a French XML file into the column for German.

Regardless of where the XML file you imported was located, when you save, test, or publish the Flash document (FLA file), a folder for each language in the Strings panel and an XML file for each language are created in the location indicated for publishing SWF files. For more information. If no publish path is indicated, the folder and file are saved in the same folder in which the FLA file is located. The XML files generated by the Strings panel are always populated with the information in the Strings panel.

 

Creating documents with multilanguage text without using the Strings panel

TOP

You can create documents with multilanguage text without using the Strings panel. For more information, see the following sections:

  • Using the XMLConnector component to connect to external XML files

  • Using a Western keyboard to enter Asian characters on the Stage

  • Using ActionScript to load external files

  • Creating documents with multilanguage text using the #include action

  • Creating documents with multilanguage text using text variables

 

Using the XMLConnector component to connect to external XML files

TOP

You can use the XMLConnector component to connect to an external XML document in order to bind to properties in the document. Its purpose is to read or write XML documents using HTTP GET operations, POST operations, or both. It acts as a connector between other components and external XML documents. The XMLConnector communicates with components in your application using either data binding features in the Flash Professional authoring environment or ActionScript code.

 

Using a Western keyboard to enter Asian characters on the Stage

TOP

With Flash, you can enter Asian characters on the Stage using a standard Western keyboard by using Input Method Editors (IMEs). Flash supports more than two dozen IMEs.

For example, if you want to create a website that will reach a broad range of Asian viewers, you can use a standard Western (QWERTY) keyboard to create text in Chinese, Japanese, and Korean simply by changing the input method editor.

In previous versions of Flash, it was not possible to input Korean characters using a standard Western keyboard. Using Flash 8, you can enter text in Korean, Japanese, and Chinese characters simply by toggling the IME from Japanese and Chinese character input to Korean character input.

NOTE : This affects only text input on the Stage, not text entered in the Actions panel. This feature is available for all supported Windows operating systems and Macintosh OS X.

To toggle between Japanese and Chinese character input and Korean character input:

  1. Select Edit >Preferences (Windows) or Flash > Preferences (Macintosh), and click the Editing tab in the Preferences dialog box.

  2. Under Input Language Settings, select one of the following options:

    • Select Chinese and Japanese to input Chinese and Japanese characters from a Western keyboard. (This is the default setting, and it should also be selected for Western languages.)

    • Select Korean to input Korean characters from a Western keyboard.

  3. Click OK.

 

Using ActionScript to load external files

TOP

If you have existing XML data you want to load, or prefer a different format for the XML file, instead of using the Strings panel, you can create a document containing multilanguage text by placing the text in an external text or XML file and loading the file into the movie clip at runtime, using the loadVariables action, the getURL action, the LoadVars object, or the XML object.

You should save the external file in UTF-8 (recommended), UTF-16BE, or UTF-16LE format, using an application that supports the format. If you are using UTF-16BE or UTF-16LE format, the file must begin with a BOM to identify the encoding format to Flash Player.

NOTE : If the external file is an XML file, you cannot use an XML encoding tag to change the encoding of the file. You should save the file in a supported Unicode format.

To include multilanguage text using an externally loaded file:

  1. In the Flash authoring tool, create a dynamic or input text field to show the text in the document.

  2. In the Property inspector, with the text field selected, assign an instance name to the text field.

  3. Create a text or XML file that defines the value for the text filed variable.

  4. Save the file in UTF-8 (recommended), UTF-16BE, or UTF-16LE format.

    If you are using UTF-16 format, make sure a BOM is included at the beginning of the file to identify the encoding:

    • For UTF-16BE, the first byte of the file should be OxFE, and the second byte should be OxFF.

    • For UTF-16LE, the first byte of the file should be OxFF, and the second byte should be OxFE.

    NOTE : Most text editors that can save files in UTF-16BE or LE automatically add the BOMs to the files.

  5. Use one of the following ActionScript procedures to reference the external file and load it into the dynamic or input text field:

    • Use the loadVariables action to load an external file.

    • Use the getURL action to load an external file from a specified URL.

    • Use the LoadVars object (a predefined client-server object) to load an external text file from a specified URL.

    • Use the XML object (a predefined client-server object) to load an external XML file from a specified URL.

 

Creating documents with multilanguage text using the #include action

TOP

You can create a document that contains multiple languages using the #include action.

You should save the text file in UTF-8 format. Save the file using an application that supports UTF-8 encoding, such as Dreamweaver.

You must include the following header as the first line of the file, to identify the file as Unicode to the Flash authoring tool:

//!-- UTF8

NOTE

Be sure to include a space after the second dash (-).

By default, the Flash authoring application assumes that external files that use the #include action are encoded in the traditional code page of the operating system running the authoring tool. Using the //!-- UTF8 header in a file tells the authoring tool that the external file is encoded as UTF-8.

To include multilanguage text using the #include action:

  1. In the Flash authoring tool, create a dynamic or input text field to display the text in the document. For more information, see Working with Text.

  2. In the Property inspector, with the text field selected, assign an instance name to the text field.

  3. Create a text file that defines the value for the text field variable. Remember to add the header //!-- UTF8 at the beginning of the file.

  4. Save the file in UTF-8 format.

  5. Use the #include directive to include the external file in the dynamic or input text field. For more information, see #include directive in the ActionScript 2.0 Language Reference.

 

Creating documents with multilanguage text using text variables

TOP

You can include Unicode-encoded contents in text variables using the syntax \uXXXX, where XXXX is the four-digit hexadecimal code point, or escape character, for the Unicode character. The Flash authoring tool supports Unicode escape characters through \uFFFF. To find the code points for Unicode characters, refer to the Unicode Standard at www.Unicode.org.

You can use Unicode escape characters only in text field variables. You cannot include Unicode escape characters in external text or XML files; Flash Player 6 does not recognize Unicode escape characters in external files.

For example, to set a dynamic text field (with the instance name myTextVar) that contains Japanese, Korean, Chinese, English, Hebrew, and Greek characters and the Euro sign, you can enter the following:

myTextVar.text = "\u304B\uD55C\u6C49hello\u05E2\u03BB\u20AC";

When the SWF file plays, the following characters appear in the text field:

 

For best results when creating a text field that contains multiple languages, make sure to use a font that includes all the glyphs your text needs.

 

Using external text or XML files that are not Unicode-encoded

TOP

If you load external files into a Flash Player 7 application that are not Unicode-encoded, the text in the external files does not appear correctly when Flash Player attempts to show them as Unicode. You can tell Flash Player to use the traditional code page of the operating system that is running the player. To do this, add the following code as the first line of code in the first frame of the Flash application that is loading the data:

system.useCodepage = true;

Set the system.useCodepage property only once in a document; do not use it multiple times in a document to make the player interpret some external files as Unicode and some as other encoding because this can yield unexpected results.

If you set the system.useCodepage property to true, remember that the traditional code page of the operating system running the player must include the glyphs used in your external text file for the text to appear. For example, if you load an external text file that contains Chinese characters, those characters do not appear on a system that uses the CP1252 code page because that code page does not include Chinese characters. To ensure that users on all platforms can view external text files used in your Flash applications, you should encode all external text files as

Unicode and leave the system.useCodepage property set to false by default. This causes Flash Player to interpret the text as Unicode.

 

Copyright © ADOBE - All Rights Reserved Worldwide

 

 

More Topics:

Working with Flash Documents

How to work in Flash WorkSpace

Working with Projects in Flash

Process to Build your First Application in Flash

Using Symbols, Instances and Library Assets in Flash

How to Build Video Player in Flash

How to Work with Color, Strokes and Fills in Flash

How to Create Document in Flash

What is Vector and Bitmap Graphics in Flash

How to Create a Banner in Flash, Part 1

How to Work with Text in Flash

How to Create a Banner in Flash, Part 2

How to Use Imported Artwork in Flash

How to Create a Banner in Flash, Part 3

How to Work with Graphic Objects in Flash

How to Work with Layers in Flash

How to Use Filters and Blends

Working with Graphics in Flash

What is Accessibility Features in Flash

How to Create Motion (Shape Tween & Motion Tween) in Flash

How to Create an Application in Flash

What is Masking in Flash

How to Work with Video in Flash

How to Use Layout Tools in Flash

What are Behaviors in Flash

How to Work with Sound in Flash

How to Create Symbols and Instances in Flash

What is ActionScript in Flash

How to Write ActionScript With Script Assist in Flash

How to Add Button Animation and Navigation in Flash

What is Data Integration in Flash

How to Work with Screens

How to Create a Presentation with Screens

What is Extending Flash

How to Create Multilanguage Text in Flash

How to Create Graphics: Draw in Flash

What is Flash Lite

Ways of Data Integration

How to Create Graphics: Create a Timeline Animation in Flash

Getting Started with Flash Lite in Flash

How to Publish Flash Documents

How to Create Graphics: Making Animations with Easing

Learning Flash Lite 1.X ActionScript in Flash

How to Export Flash Content and Images from Flash

How to Create Graphics: Applying Gradients in Flash

Process of Writing and Editing ActionScript 2.0 in Flash

How to Create Accessible Content in Flash

How to Create Graphics: Apply Graphic Filters and Blends

What is Data and Data Types in Flash

Process of Printing from SWF Files in Flash

Using ActionScript: How to Use Script Assist mode in Flash

Learn Syntax and Language Fundamentals in Flash

How to Create E-learning Content in Flash

Using ActionScript: How to Write Scripts in Flash

Working with Functions and Methods in Flash

Process of Using Templates in Flash

Using ActionScript: Process of Adding Interactivity in Flash

What are Classes in Flash

Control Tag Summary of XML to UI in Flash

Using ActionScript: How to Create a Form with Conditional Logic and Send Data in Flash

What is Inheritance in Flash

What is Data Integration: Overview

Using ActionScript: How to Work with Objects and Classes in Flash

Overview on Interfaces in Flash

What is Data Integration: Using XML for a Timesheet

How to Work with Text and Strings in Flash

How to use Handling Events in Flash

What is Data Integration: Using XUpdate to Update the Timesheet

Learning Animation, Filters and Drawings in Flash

How to Work with Movie Clips in Flash

How to Create Interaction with ActionScript in Flash

How to Work with Images, Sound, and Video in Flash

How to Work with External Data in Flash

What is Security in Flash

How to Debug Applications in Flash

List of Error Messages in Flash

Using Object-Oriented Programming with ActionScript 1.0 in Flash

How to Write Scripts for Earlier Versions of Flash Player in Flash

List of all Keyboard Keys and Key Code Values for using in Flash

Terminology

Introduction to Components in Flash

What are Components in Flash

How to Create an Application with Components

How to Work with Components in Flash

How to Handle Component Events in Flash

How to Customize Components in Flash

How to Create Components in Flash

What is Collection Properties in Flash