text (TextField.text property)

public text : String

Indicates the current text in the text field. Lines are separated by the carriage return character ("\r", ASCII 13). This property contains the normal, unformatted text in the text field, without HTML tags, even if the text field is HTML.

Availability: ActionScript 1.0; Flash Player 6

Example

The following example creates an HTML text field called my_txt, and assigns an HTML-formatted string of text to the field. When you trace the htmlText property, the Output panel displays the HTML-formatted string. When you trace the value of the text property, the unformatted string with HTML tags displays in the Output panel.

this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 400, 22);
my_txt.html = true;
my_txt.htmlText = "<B>Lorem ipsum dolor sit amet.</B>";

trace("htmlText: "+my_txt.htmlText);
trace("text: "+my_txt.text);

This generates the following output:

 htmlText: <P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="12" COLOR="#000000" KERNING="0">
 <B>Lorem ipsum dolor sit amet.</B></FONT></P>
 text: Lorem ipsum dolor sit amet.

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components' DepthManager class instead of the MovieClip.getNextHighestDepth() method.

See also

htmlText (TextField.htmlText property)


Flash CS3


 

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

Current page: http://livedocs.adobe.com/flash/9.0/main/00002244.html