O'Reilly logo

Essential ActionScript 3.0 by Colin Moock

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Text Fields and the Flash Authoring Tool

In the Flash authoring tool, text fields can be created manually using the Text tool. Each manually created text field is set to one of three author-time text field types: static text, dynamic text, or input text. At runtime, each manually created text field is represented in ActionScript by an object that matches its author-time text field type. Text fields of type "static text" are represented by StaticText instances. Text fields of type "dynamic text" are represented by TextField instances with type set to TextFieldType.DYNAMIC. Text fields of type "input text" are represented by TextField instances with type set to TextFieldType.INPUT.

The text content of text fields of type "static text" can be read at runtime through ActionScript code but cannot be modified. By contrast, the text content of text fields of type "dynamic text" or "input text" can be both read and modified. Hence, Flash authors should choose the static text type when a text field's content does not need to be modified at runtime. To create text fields whose content can be modified at runtime Flash authors should choose the dynamic text or input text types.

To access all the text in all the static text fields in a given DisplayObjectContainer instance, use the TextSnapshot class (whose primary purpose is enabling character selection across multiple individual StaticText objects).

Tip

Text fields that are static text type cannot be created with ActionScript code; the StaticText ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required