Recipe 9.7. Displaying Text


Problem

You want to display text within a text field.

Solution

Set the text property of a text field.

Discussion

Aside from being used as input fields, text fields are often used to display text to the user. Setting a text field's text property causes the corresponding text to display in the field:

field.text = "this will display in the field";

Special characters, such as \\t for tab and \\n for newline, can be used within a text string.

You can append text by using the += operator or the appendText( ) method:

field.appendText("new text");

See Also

Recipe 9.8 for information on support for HTML-formatted text.




ActionScript 3. 0 Cookbook
ActionScript 3.0 Cookbook: Solutions for Flash Platform and Flex Application Developers
ISBN: 0596526954
EAN: 2147483647
Year: 2007
Pages: 351

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