Chapter 7. Working with Text Basics


Text is one of the ways in which you can communicate with users in a Flash movie. You can use text to label buttons and movie clips, or you can use text to display detailed information to the user. You can display text that you have hardcoded into your Flash movie at authoring time or dynamic text that you generate at runtime. Equally important is that text is one of the means by which users can communicate with your Flash movie. Input text fields allow users to enter values such as their username, a quantity of a product, or information for a feedback form.

Flash text is simple, because you can accomplish a lot with text in very intuitive ways. At the same time, Flash text is complex, because Flash offers many options to manipulate and format text. Although this chapter focuses on solutions that don't require scripting, we'll see how ActionScript can offer powerful control over text. But don't panicthe ActionScript in this chapter is minimal and easy to understand.

There are a few basic things you should know about Flash text while reading the recipes in this chapter. Flash supports three kinds of text: static, dynamic, and input. Use static text to display text that does not need to update at runtime. If the text is likely to update at runtime, use dynamic text, which you can modify at runtime. And lastly, input text allows users to enter text values into your movie. Input text is a subset of dynamic text, in that you can modify them in the same way at runtime. The distinction is that users can enter values only into input text.

When you create text at authoring time, Flash defaults to static text. However, after you have selected a different text type, that text type is retained and used for subsequent text fields that you create unless you again choose a different text type. If you accidentally create a text field of the wrong text type, there is no need for alarm. You can always select the text field and modify its text type setting after the fact.

Unlike text fields created at authoring time, text fields created at runtime default to dynamic. And, in fact, you cannot even create a static text field at runtime, because static text fields are not true objects, in that they do not have instance names. Text fields created at runtime (meaning they are created using ActionScript) must be true objects.

One major benefit of using Flash as a medium for design on the Web is that you have the option of embedding the font outlines in the SWF. Thus you can be assured that the text will render the same way on every computer regardless of whether the computer has a particular font installed. Note that there are trade-offs with embedding fonts and that you also have the option of using system fonts when appropriate.

In this chapter, the topics of the recipes apply to all types of text ( static, dynamic, and input) unless stated otherwise. However, the focus of this chapter is on authoring time text, and therefore the emphasis is on static text. Chapter 8 discusses more dynamic text topics.




Flash 8 Cookbook
Flash 8 Cookbook (Cookbooks (OReilly))
ISBN: 0596102402
EAN: 2147483647
Year: 2007
Pages: 336
Authors: Joey Lott

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