beautypg.com

Multilanguage text and actionscript, Use actionscript to load external files – Adobe Flash Professional CS3 User Manual

Page 295

background image

FLASH CS3

User Guide

289

See also

“Publishing overview” on page 419

Multilanguage text and ActionScript

Use ActionScript to load external files

To load existing XML data, or use a different format for the XML file, use the

loadVariables

action, the

getURL

action, the

LoadVars

object, or the

XML

object to create a document that contains multilanguage text by placing the

text in an external text or XML file and loading the file into the movie clip at runtime.

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. The following table lists the BOM to include to identify the encoding:

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

Note: If the external file is an XML file, you cannot use an XML encoding tag to change the file encoding. Save the file
in a supported Unicode format.

1

In the Flash authoring application, 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

Outside of Flash, create a text or XML file that defines the value for the text field variable.

4

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

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. For more

information, see XML in the ActionScript 2.0 Language Reference.

See also

“Using the XMLConnector component to connect to external XML files” on page 291

“Unicode and Flash Player” on page 281

“Working with text” on page 261

Create multilanguage documents using the #include action

To create a document that contains multiple languages, use the

#include

action.

UTF Format

First Byte

Second Byte

UTF-16BE

OxFE

OxFF

UTF-16LE

OxFF

OxFE