18.3. Text Field Options
Dynamic text fields and user-input text fields share most, but not all, options used to configure their display and input features. Figure 18-1 shows the Text Options panel for user-input and dynamic text fields.
Figure 18-1. The Text Options panel
18.3.1. Line Display
The Variable option in the Text Options panel is used to name a dynamic or user-input text field. Text fields must be named in order to be manipulated with ActionScript. When naming text fields, follow the rules for constructing legal variable names described in Chapter 2, "Variables", and Chapter 14, "Lexical Structure".
When set in the Text Options panel, the Border/Bg option causes a black outline to be displayed around a text field and a white background to be placed behind the viewable region of the field. These colors and styles are not customizable. To produce a custom background for a text field, unset the Border/Bg option and manually draw a shape behind the text field.
18.3.4. Word Wrap
When used in conjunction with the Multiline setting of the Line Display option, Word Wrap soft wraps lines of text that would otherwise exceed the width of the field. This setting applies to both text entered by users and text displayed via ActionScript.
If you set the Word Wrap option while Multiline is selected and then choose Single Line, the Word Wrap setting will still apply. Be sure to unset Word Wrap if you do not want text to wrap at the end of each line.
The text in a dynamic text field may be selected by the user only if the field's Selectable option is set. Even then, the dynamic text may be copied but not cut or edited. User-input text fields are always selectable, and their text can always be copied, cut, or edited.
18.3.6. Max Characters
Used only with user-input text fields, the Max Characters option limits the amount of text a user can enter into a text field. By default, Max Characters is set to 0, which allows an unlimited amount of text to be entered. Other settings allow the specified number of characters to be entered.
Max Characters is often used with forms that require a certain format for their data. For example, we could use it to limit a date entry to a two-digit day, a two-digit month, and a four-digit year.
18.3.7. Embed Fonts
By default, all dynamic and input text fields use device fonts (the fonts installed on the user's system). When device fonts are used, if the user has the font specified in the Character panel for the text field, the text appears on the user's system as it appeared during authoring (but without antialiasing). If the user does not have the font, an alternative font is used, which is not always desirable.
To ensure that text will render in a particular font, we embed that font in the movie using the Embed Fonts options, shown enlarged in Figure 18-1.
Embedding a complete Roman font typically adds 20-30 KB to a movie (Asian fonts can be much larger). If we're using only a subset of the characters, we can save file space by embedding only the characters we need. Characters that we don't embed cannot be entered by the user or displayed via ActionScript. We can use this to our advantage to restrict text entry to certain characters.
You must set the Embed Fonts option separately for every text field that uses a particular font, even if multiple text fields use the same font. However, file size is not affected when multiple text fields embed the same font -- only one copy of the font is downloaded with the movie. To apply the same Embed Fonts option to many text fields at once, select the desired fields and then set the Embed Fonts option as usual.
Text displayed in text fields with embedded fonts is always antialiased. Therefore, using embedded fonts with sizes smaller than 10 point is not recommended, because antialiased text becomes unreadable below 10 point in most fonts. To prevent a font from antialiasing, use device fonts (i.e., system fonts) by unselecting all Embed Fonts options. Device fonts are never antialiased.
See Section 18.5.11, "Using HTML as Output" later in this chapter for more important details on fonts in text fields.
Copyright © 2002 O'Reilly & Associates. All rights reserved.