Macromedia Flash MX and Unicode text
Macromedia Flash MX introduces Unicode Support for the Macromedia Flash Player. The Unicode Standard, developed by the Unicode Consortium, is a universal character encoding standard used for representation of text for computer processing. Unicode is for displaying characters not in your system codepage, which helps computers to display non-traditional codepage characters, such as Cyrillic or Chinese. Macromedia Flash Player 6 is completely Unicode and can display any language available on your OS.
The Macromedia Flash MX authoring environment is based on the traditional codepage for each language. For example, the Japanese version of Macromedia Flash MX will use Shift-JIS codepage. Macromedia Flash MX will convert the text to Unicode when publishing the SWF. The text you can use is in the authoring environment is limited to the characters within the specific codepage of the application. Even though the Flash Player can display Korean text, for example, a Flash author could not create such text using US English (CP1252) because the codepage does not contain any Korean characters. The clipboard for copy and paste is linked to the system codepage, so on a Shift-JIS machine you could cut and paste Shift-JIS text but you would not be able to do this on an English based system.
Using non codepage characters in the authoring environment
Include files
Use Unicode escape notation
Change the codepage for the system
Additional information
Include Files
Use the #include action to import UTF-8 data into the Macromedia Flash movie.
For example, #include "myUft8File.as" will import a text file with UTF-8 encoded text. The text would then be assigned to dynamic textfields to display the Unicode text. The .as file should have //!-- UTF8 as its first line so Macromedia Flash MX knows that it is a UTF-8 text file. An important thing to remember is the text file being included must be formatted as UTF-8. Notepad on Windows 2000 is one program that can save text files as UTF-8.
Use Unicode escape notation
Text can be set in the contents of a text variable using the Unicode escape character syntax, which is in the form '\uXXXX' where the 4 digits specified are the UTF code points. This can be found either in books that refer to Unicode or with tools such as the Character Map utility on Windows.
For example: to set a dynamic text field (with the variable namemyTextVar) that contains Chinese, Korean,and English characters as well as the Euro symbol, you can enter the following:
myTextVar = "\u7000\u5000\u5122 Hello There \u327B\u20AC";
To make this appear correctly, either use a device font such as _sans, a font that you know will be installed on the end user's machine, or a font that contains Unicode Glyphs such as "Arial Unicode MS" (Windows). Note that you can't currently embed all characters from multiple languages in a SWF, only English and the current language such as Japanese will work correctly. Also, embedding glyphs for fonts such as Japanese can increase the size of the SWF significantly.
Change the codepage for the system
To enter non system codepage based text, the user needs to change which input language should be used. This usually requires that the user install the various languages and fonts ahead of time before this mechanism can be used. In addition, the user needs to choose the target system default language / regional encoding during authoring.
Additional information
To choose an encoding language (Windows):
- In the Control Panel, select Regional Options.
- With the General tab selected, under the Setting for the current user, choose a language from the Your Locale (location) pop-up menu.
- Still on the General tab, under Language settings for the system, click the Set default button.
- In the Select System Locale dialog box, choose a language for the default language.
- Click OK.
-
Note:For authors only: if you need to type characters into Flash at author time, continue to the next steps:
Windows 2000 - Go to Control Panel, select Regional Options, select Advanced
- Select language to match the launguage version of the non-unicode programs you want to use, select pulldown menu, and select the language you want to make as default.
- After the selection, you must reboot the system. Then you can use that language as well as English.
-
Windows XP: - Go to Control Panel, select Regional and Language Options.
- Click on the Advanced tab and select the target authoring language (eg. Japanese) in the pull-down menu for "Language for non-Unicode Programs".
- Click Apply.
- Reboot your system when prompted.
- Note: Windows 98 does not support choosing an encoding language. If using characters outside your current code page, it is not recommended to type directly into Macromedia Flash MX, but to instead use another method such as #include.
To choose an encoding language (Macintosh OS 9.x):
When you install the Macintosh Language Kit, the encoding is automatically chosen.
To choose an encoding language (Macintosh OS X.x):
- In System Preferences, select International.
- Select your primary language.
- Then click OK.
- It will be effective after you restart the system or log out and log in again. For more information on language use in Macintosh OS X see Mac OS X 10.1: Viewing and Typing Text in Different Languages in the Apple Knowledge Base.
If an author does not want Flash Player 6 to use Unicode for text then set the System.useCodepage to true:System.useCodepage=true
This ActionScript will tell the Flash Player to behave like earlier versions of the Macromedia Flash Player and treat all text based on the end user's codepage. Since the traditional codepage is different on different machines, usingSystem.useCodepage=true will make Western text work on Western machines but it won't work properly on, for example, Japanese machines. The reverse would be true for Japanese text. Sometimes this is good enough to reach the target audience, but the way to make your text work reliably everywhere, regardless of language or player platform, is to convert the text to Unicode.
When loading data (via LoadVariables or XML) the Macromedia Flash Player 6 will assume UTF-8 encoding. UnlessSystem.useCodepage = true, in which case the Macromedia Flash Player will load in the traditional codepage of the OS. (CP1252 on an English system, Shift-JIS on a Japanese system, etc.). Refer to the online ActionScript Dictionary for details of System.useCodepage.
Setting System.useCodepage=true will disable the Flash Player from reading Unicode so make sure you are not using any Unicode functionally.
For more information on the Unicode Standard, see:
- Working with Multiple Languages in the Macromedia Flash Support Center
- The Unicode Home Page
- What is Unicode?
This content requires Flash
To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.
Download the free Flash Player now!
