Flash Lite 2.x and 3 Help

TextField class

Text fields are visual elements on the Stage that let 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, and enable multiline support.

You use the TextField class to create text fields. All dynamic and input text fields in a SWF file are instances of the TextField class. You can give a text field an instance name in the Property inspector and use the methods and properties of the TextField class to manipulate it with ActionScript. TextField instance names are displayed in the Movie Explorer and in the Insert Target Path dialog box in the Actions panel.

To create a text field dynamically, do not use the NEW operator; instead, use MovieClip.createTextField().

The methods of the TextField class let you set, select, and manipulate text in a dynamic or input text field that you create during authoring or at runtime.

All properties of the TextField class are supported in Flash Lite 2.x and later, but you can only use text fields to display device fonts. Device fonts are special fonts in Flash that are not embedded in a SWF file. Flash Lite uses whatever font on the mobile device 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 devices 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).

For more information about the TextField class, see the following references:

  • Developing Flash Lite 2.x and 3.0 Applications
  • Chapter 12, "Working with Text and Strings," in Learning ActionScript 2.0 in Flash
  • Chapter 2, "ActionScript Classes," in Flash Lite 2.x and 3.0 ActionScript Language Reference

Property summary

The following table lists the properties of the TextField class that are not supported when using ActionScript for Flash Lite 2.x and later.

Property

Description

antialiasType

Indicates the type of anti-aliasing used for this TextField instance.

menu

Associates a ContextMenu object with a text field

mouseWheelEnabled

A Boolean value that indicates whether Flash Player should automatically scroll multiline text fields when the mouse pointer clicks a text field and the user rolls the mouse wheel.

restrict

Indicates the set of characters a user can enter into the text field.

sharpness

The sharpness of the glyph edges in this TextField instance.

styleSheet

Attaches a style sheet to the text field.

thickness

Indicates the thickness of the glyph edges in this TextField instance.

Method summary

The following table lists the methods of the TextField class that are not supported when using ActionScript for Flash Lite 2.x and later.

Method

Description

getFontList

Returns the names of fonts on the player's host system as an array.

 

Send me an e-mail when comments are added to this page | Comment Report