Detailed instructions for use are in the User's Guide.
[. . . ] Learning ActionScript 2. 0 in Flash
Trademarks 1 Step RoboPDF, ActiveEdit, ActiveTest, Authorware, Blue Sky Software, Blue Sky, Breeze, Breezo, Captivate, Central, ColdFusion, Contribute, Database Explorer, Director, Dreamweaver, Fireworks, Flash, FlashCast, FlashHelp, Flash Lite, FlashPaper, Flash Video Encoder, Flex, Flex Builder, Fontographer, FreeHand, Generator, HomeSite, JRun, MacRecorder, Macromedia, MXML, RoboEngine, RoboHelp, RoboInfo, RoboPDF, Roundtrip, Roundtrip HTML, Shockwave, SoundEdit, Studio MX, UltraDev, and WebHelp are either registered trademarks or trademarks of Macromedia, Inc. and may be registered in the United States or in other jurisdictions including internationally. Other product names, logos, designs, titles, words, or phrases mentioned within this publication may be trademarks, service marks, or trade names of Macromedia, Inc. or other entities and may be registered in certain jurisdictions including internationally. [. . . ] Select
Control > Test Movie to test the SWF file.
380
Working with Movie Clips
CHAPTER 12
Working with Text and Strings
Many of the applications, presentations, and graphics that you create with Macromedia Flash Professional 8 or Macromedia Flash Basic 8 include some kind of text. You can use many different kinds of text. You might use static text in your layouts, but dynamic text for longer passages of text. Or you might use input text to capture user input, and text in an image for your background design. You can create text fields with the Flash authoring tool, or use ActionScript. One way to display text is to use code to manipulate how strings appear before they are loaded and displayed on the Stage at runtime. You can work with strings in an application in several ways, such as sending them to a server and retrieving a response, parsing strings in an array, or validating strings that the user types into a text field. This chapter describes several ways to use text and strings in your applications, focusing on using code to manipulate text. The following list describes terminology used in this chapter.
Alias Aliased text does not use color variations to make its jagged edges appear smoother, unlike anti-aliased text (see following definition).
12
You use anti-aliasing to smooth text so the edges of characters that appear onscreen look less jagged. The Anti-Alias option in Flash makes text more legible by aligning text outlines along pixel boundaries, and is particularly effective for clearly rendering smaller font sizes.
Characters
Anti-alias
Characters are letters, numerals, and punctuation that you combine to make
up strings.
381
Device fonts are special fonts in Flash that are not embedded in a SWF file. Instead, Flash Player uses whatever font on the local computer that most closely resembles the device font. Because font outlines are not embedded, a SWF file size is smaller than using embedded font outlines. However, because device fonts are not embedded, the text that you create with these fonts looks different than expected on computer systems that do not have a font installed that corresponds to the device font. Flash includes three device fonts: _sans (similar to Helvetica and Arial), _serif (similar to Times Roman), and _typewriter (similar to Courier).
Fonts String Text
Device fonts
Sets of characters with a similar font face, style, and size. A sequence of characters.
A series of one or more strings that can be displayed in a text field, or within a user interface component.
Text fields A visual element on the Stage that lets you display text to a user. Similar to an input text field or text area form control in HTML, Flash lets you set text fields as editable (read-only), allow HTML formatting, enable multiline support, password masking, or apply a CSS stylesheet to your HTML formatted text. Text formatting
You can apply formatting to a text field, or certain characters within a text field. Some examples of text formatting options that can be applied to text are: alignment, indenting, bold, color, font size, margin widths, italics, and letter spacing. For more information on text, see the following topics:
About text fields . . 384 About loading text and variables into text fields . . 398 About font rendering and anti-alias text . 414 Formatting text with Cascading Style Sheet styles . [. . . ] Top-level functions are functions that don't belong to a class (sometimes called predefined or built-in functions), meaning that you can call them without a constructor. Examples of functions that are built in to the top level of the ActionScript language are trace() and setInterval();. User-defined functions are functions that you create to use in applications, as opposed to functions in built-in classes that perform predefined functions. You name the functions yourself and add statements in the function block.
809
Variables
are identifiers that hold values of any data type. [. . . ]