Text Field Types in Flash


Flash allows you to include text in your projects in a variety of ways. Often one Flash project will contain several different text types, each suited to a specific kind of content. We describe the steps for creating text boxes and editing type later in this chapter, but will begin here with an overview of the three main text types used in Flash:

  • Static: Static text boxes are used for display type or text content created at author-time (in the .fla), that won't change at run time (in the .swf).

  • Dynamic: Dynamic text fields are used to hold text content that is generated at run time from a live data source, or text that will be updated dynamically, such as weather information or sports' scores.

  • Input: Input text fields are exactly what they sound like, fields created for text that users enter at run time. You use input text fields whenever you need users to do things such as enter passwords or answer questions.

Note 

For the purpose of brevity, we often refer to both Dynamic and Input text fields as editable text fields because both text-field types can be modified at run time (unlike Static text boxes, which can be modified only at author-time).

On the CD-ROM 

You will find examples of text field styles in the textSamples.fla file in the ch08 folder on the CD-ROM.

The Text tool is used to create text boxes and to enter and modify type. When you first create a text box in Flash, the default text type is Static, but you can assign it a different text type in the Property inspector at any time. Subsequent text boxes are automatically assigned the type style you have selected most recently. This makes it quicker to create a series of text boxes of the same type, but it means you should double-check the settings if you need text boxes of different types.

Figure 8-1 shows the basic controls that appear in the collapsed Property inspector when the Text tool is selected from the Tools panel.

image from book
Figure 8-1: The basic text options that appear in the (collapsed) Property inspector when the Text tool is active or a Static text box is selected on the Stage

New Feature 

To make it easy to access the new filters available in Flash 8, the Property inspector has been modified to make room for the Parameters tab and the Filters tab to the right of the Properties tab. To switch views from Properties to either Parameters or Filters, simply click the relevant tab if the Property inspector is open or use the Window ð Properties submenu to select the tab view that you want active when the Property inspector appears.

Static Text Boxes

Although the term Static text sounds limiting, this type of text box actually offers the most design options at author-time. Static text boxes can be scaled, rotated, flipped, or skewed, assigned alpha levels, and modified with filters while preserving editable text characters. Static text can also be animated or layered like any other graphic element in Flash. By default, Flash embeds the outlines for any fonts used in Static text for display on other machines, but you may also choose to specify a generic device font to reduce the size of your final movie or to eliminate anti-aliasing (or smoothing) on small text.

New Feature 

Flash 8 replaces the old Alias text button with a more sophisticated menu of anti-aliasing options. An improved rendering engine built into Flash Player 8, and precise authoring controls in the Property inspector, make it much easier to find a setting that renders smooth, legible text, even at small point sizes. If it turns out that you still prefer aliased text, simply choose the Bitmap text (no anti-alias) setting from the drop-down menu and you will get the same result as you did with the Alias text button in Flash MX 2004.

The Link entry field is another helpful feature in the Property inspector that allows you to select sections of Static or Dynamic (horizontal) text and enter a URL to create a text link to a Web page or to an e-mail address in your Flash movie without any additional coding.

By default, Static text boxes are horizontal, and they can be either expanding boxes, which allow you to keep typing along one line as it extends to fit the type, or fixed-width boxes, which constrain your text box to a set width and auto-wrap the text to fit. These two types of text fields look the same when you select them by clicking once with the Selection tool, but when you double-click, you can see the text box handle icon that indicates the current behavior of the box. Figure 8-2 shows the respective icons for expanding, or label, text and for fixed-width, or block, horizontal Static text.

image from book Figure 8-2: The handle icons for expanding (left) and fixed-width (right) horizontal Static text boxes

New Feature 

All text boxes and text fields in Flash 8 now have handles that make it possible to resize the text area just by clicking once with the selection tool and then dragging one of the handles. Scaling the text area does not change the size of the type as it does in some other applications.

Static text boxes in Flash include the option for left-to-right-reading or right-to-left-reading vertical text boxes. Have you ever wanted a line of text characters to stack vertically, but found it tedious to use a hard return between each letter? Thanks to vertical text, you can easily switch your type alignment from horizontal to vertical, with characters that are either stacked or rotated. This eliminates the headache of trying to read sideways while editing type — with a simple menu choice you can switch from vertical to horizontal and back again with no hard returns or freehand rotations required. Figure 8-3 illustrates how the vertical text and rotate text options change the orientation of Static text.

image from book Figure 8-3: Vertical text box orientations— (A) vertical expanding, (B) vertical fixed-height left to right, (C) vertical fixed-height left to right with rotate option, (D) vertical fixed-height right to left, and (E) vertical fixed-height with rotate option

Aside from giving designers authoring in English more options for cool layouts, this feature makes Flash much friendlier for designers authoring in language sets that require vertical or right-to-left character flow. As we describe in the "Vertical text options" section later in this chapter, you can modify the alignment of vertical text to anchor it to the top, center, or bottom of the text box.

Although the default orientation for text in Flash is horizontal and left to right, you can modify the Vertical text settings in the Text category of the Flash Preferences dialog box, as shown in Figure 8-4 (File ð Preferences or, in OS X, Flash ð Preferences). To make all new Static text boxes automatically orient vertically, select the Default text orientation check box. To change the default text flow, select the Right to left text flow check box. You also have the option of disabling kerning on vertical text by selecting the No kerning check box.

image from book
Figure 8-4: Changing the default Vertical text settings in the Preferences dialog box

Editable Text Fields: Dynamic and Input

Editable text, like Static text, begins as a block, but when it's converted to Dynamic or Input behavior, these editable text boxes are referred to as text fields. Think of an editable text field as an empty window with a name attached to it. When text or data is sent to the Flash movie (.swf), it is sent to a specific named text instance, which ensures that it will be displayed in the proper window or editable text field. Dynamic text fields can display information supplied from a database, read from a server-side application, or loaded from another Flash movie (or another part of the same Flash movie).

Because Dynamic text fields are generated or edited on the fly (at run time), there are limitations on how much you can control the appearance of the text at author-time. You cannot apply special formatting or shape modifications (such as skewing or kerning) directly to Dynamic text fields. However, Flash recognizes Dynamic text field instances the same way other Movie Clip instances recognize Dynamic text field instances, so you can assign a name to a Dynamic text field instance and use ActionScript to control its appearance.

Note 

All editable text fields are recognized as nameable instances of the Text Field object. You should only use variable names to identify editable text fields for backwards compatibility with legacy versions of the Flash Player (Flash Player 5 or older), and the variable name or var attribute of a text field should not be the same as its instance name.

You can author Dynamic text horizontally in expanding or fixed-width fields, but you cannot rotate or modify it with the Vertical text option. Figure 8-5 shows how a Dynamic or Input text field will display when it's unselected (A) and how the field type is indicated by the handle icons when the text is double-clicked. If you plan to work with multiline text fields, but you have limited space for the text, you can set the text field behavior to scrollable in the Text menu (Text ð Scrollable); this enables the text to extend outside the visible area of the text box.

image from book
Figure 8-5: An unselected Dynamic or Input text field is indicated in the authoring environment by a dashed outline (A); when selected, you can adjust the size of the field by dragging any of the handles on the blue outline (B); when double-clicked for editing, the field displays either an expanding handle icon (C), or a fixed-width handle icon (D); and if the text field is set to be scrollable, the square handle changes from white/empty to black/filled (E).

When the Render text as HTML button in the Property inspector is toggled on, Flash recognizes rich text formatting, such as links and font styles indicated in Dynamic text with HTML tags, and applies them when the text is rendered in the Flash movie (.swf).

Tip 

If you change the size of an expanding text field by dragging one of the selection handles, the field automatically converts into a fixed-width text field. To change a fixed-width text field into an expanding text field, double-click the square fixed-width handle icon.




Macromedia Flash 8 Bible
Macromedia Flash8 Bible
ISBN: 0471746762
EAN: 2147483647
Year: 2006
Pages: 395

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net