Working with Text


There are three text field types in Flash: static, dynamic, and input. Static text fields, and the text they contain, are created at author-time. Dynamic and input text fields and their contents can be created at author-time or at run-time with ActionScript. This section focuses on static text fields. The other types are discussed in detail in Chapter 16, "Putting It All Together: Creating an XML-Based Photo Slide Show."

To create a static text field, click on the Text tool and then on the stage. This places a new text field on the stage, with a cursor ready to accept the input you type from your keyboard. You can set formatting options for text fields with the Properties inspector. These options include font, font size, color, and alignment. Additional options for text fields include changing the direction of text from horizontal to vertical. You can set the spacing between characters. By selecting individual characters in a static text field, you can also create superscript and subscript formatting (see Figure 9.25).

Figure 9.25. Superscript and subscript in a static text field.


Static text fields can be given a URL link and target attributes, making the text object analogous to an embedded link in an HTML document. When a text field has a URL link, the background for the text is part of the hit area, which is the area that responds to the user's mouse.

Embedded and Device Fonts

In the Flash authoring environment, you have access to all the fonts that are currently installed on your system. In an HTML document, only the name of the font is stored in that document. The fonts themselves are not included in the HTML file. For those fonts to appear on a user's screen, the specified font must be on the user's system. If it isn't, the browser uses its default font instead. There are two options in Flash for ensuring that your text appears as you designed it, or at least close: embedding and device fonts. They both have advantages and weaknesses.

For static text, embedding is automatic. When a font is embedded, the outlines of the font are saved as vector shapes in the Flash file. Although this assures that the font you chose will always be the font that is displayed, each character adds to your project's file size.

The other option is to use device fonts, which let you set a category of fonts for a text field, such as serif or sans serif fonts. The player then displays a font from the user's system from that category. A sans serif font might be rendered as Helvetica on a Mac or rendered as Arial on a PC. The advantage of using device fonts is that you can keep your file size small while maintaining loose control over font types in your project. It's a good idea to use device fonts when displaying large amounts of text.

Breaking Text Apart

To break apart text, select a text field on the stage and then go to Modify, Break Apart. Breaking apart text is different from breaking apart bitmaps. Flash breaks text apart in two steps. The first time, it breaks the text field into individual text fields for each character from the original field. This can add significant size to your file (more than doubling the size of the same text in a single text field). So why would you do this? Because the individual characters are then available to animate or apply individual effects to. This can produce some nice effects, but use it sparingly because it can bloat file size.

The second step of breaking apart text is to break apart a text field containing a single character and convert it into a vector shape that can be manipulated just as any other vector shape. You can create some unique font effects this way (see Figure 9.26).

Figure 9.26. A unique font effect created by breaking apart a letter into a vector shape and modifying its curves.


Using Snap to Pixels to Automatically Align Text

The placement of text on the stage affects how legible that text is in the published .swf file. If a text field is not aligned exactly on a whole pixel, the text appears blurry when rendered. For text to be clearly legible in Flash, modify the snapping settings to Snap to Pixels. You can change this setting by choosing View, Snapping, Snap to Pixel. You must turn off all other snapping options by selecting them in the same menu.

In previous versions of Flash, you had to open the menu repeatedly for each snapping option you wanted to change. Now there is a panel where you can edit all snapping options at once. Stage borders settings, object spacing, and center alignment are available through the Advanced button on the Edit Snapping interface, which you can open by choosing View, Snapping, Edit Snapping (see Figure 9.27).

Figure 9.27. Edit Snapping interface.


If you place a text field on the stage without using the Snap to Pixel option, you can still make sure that it is positioned on a whole pixel. Select your text field and go to the Property inspector. You can then round off the X and Y coordinates of your text field by directly changing their numerical values (see Figure 9.28). For example, if the X value is 362.9, you can round that up to 363.0. Even a change that small makes your text display more clearly.

Figure 9.28. X and Y coordinates in the Property inspector.


Alignment and Justification

In Flash, as with most word processors, you can control how the text is aligned in the text field. The text can be aligned to the left, center, or right, or justified across the entire field. Justified alignment spaces the text so that it is flush to the right and to the left, although there are irregular spaces between individual characters.

Left or right alignment gives you the clearest text. Center alignment and justified text can result in blurry characters because these formats can position characters off-pixel.

Turning Anti-Aliasing Off

Anti-aliasing smoothes the outlines of text so that the edges look less jagged when rendered on the screen. However, when using smaller font sizes, some fonts appear clearer with anti-aliasing turned off (see Figure 9.27). To control the anti-aliasing setting for an individual text field, select the text-field on the stage and then turn anti-aliasing on or off in the Property inspector.



Special Edition Using Macromedia Studio 8
Special Edition Using Macromedia Studio 8
ISBN: 0789733854
EAN: 2147483647
Year: 2003
Pages: 337

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