Previous Page
Next Page

Tripod >> 3pod Tips & Learning and manuals for educations

Recipe 8.13. Entering International and Nonstandard Characters

Problem

You want to enter international and/or nonstandard characters into text fields, text inputs, or text areas.

Solution

For text fields you can use the Alt-sequences to enter the characters at authoring time. Or, you can copy and paste from another application.

For text fields, text areas, and text inputs, use the Unicode escape sequences to add these characters at runtime.

Discussion

Flash uses Unicode for character encoding, so that it can support a wide range of languages and special characters. And because of this support, Flash movies can display any character as long as the user's computer has the appropriate font.

If you are using characters available on a standard keyboard, you can enter those characters without any special considerations. However, if you want to enter other characters, there are two different ways to do this: you can enter the values at authoring time (for text fields) or you can use ActionScript to add the values at runtime.

When you enter Unicode values to a text field at authoring time, you can either copy and paste the characters from another application or you can enter them using the Alt-sequences. For example, you can enter Alt-0169 (Windows) or Option-G (Macintosh) to add the copyright symbol (©) to a text field at authoring time.

If you want to use ActionScript to display any of these nonstandard characters in a dynamic (or input) text field at runtime, you can use the Unicode escape sequences within the string you assign to the text field's text property. For example, the escape sequence \u00a9 is the Unicode escape sequence for the copyright symbol:


	// This code, when placed on the same timeline as the dynamic text field,
	// tField, displays: this is a copyright symbol: ©
	tField.text = "this is a copyright symbol: \u00a9";

If you are loading the text from an external source using ActionScript, and then applying it to the text field, text input, or text area at runtime, you can load and display any Unicode text and it should render properly within Flash. If, for example, you are loading text from a text file, make sure the text file is saved as UTF-8 or UTF-16. If you save the document as UTF-16, you need to make sure that contains a byte order mark. Otherwise Flash will interpret the content as UTF-8. Most editors that save to UTF-16 automatically add the byte order mark.

Tripod >> 3pod Botom Tips & Learning and manuals for educations

Previous Page
Next Page

 

bluedot bluedots greydots pinkdots

Tripod >> 3pod Tips & Learning and manuals for educations