The Text control displays multiline, noneditable text. The Text control does not support scroll bars; its preferred size is a square large enough to display the specified text.
The Text control supports HTML text and a variety of text and font styles. The text always wraps at the control boundaries, and is always aligned at the top of the control. The Text control is transparent so that the background of the component's container shows through, and the control has no borders.
MXML Syntax
The <mx:Text> tag inherits all the properties of its parent classes, and defines the following properties:
Specifies whether the text can be selected, true, or not, false. Making the text selectable allows you to copy and paste it. The default value is true.
version
static
version:
String
Version string for this class.
Examples
TextExample.mxml
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Text control -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" backgroundColor="#FFFFFF">
<mx:Script>
<![CDATA[
var sampleText= "The Text control displays multiline, noneditable text." +
"The Text control does not support scroll bars; its preferred size is a square large enough to display " +
"the specified text. " +
" The Text control supports HTML text and a variety of text and font styles. " +
"The text always wraps at the control boundaries, and is always aligned at the top of the control." +
"The Text control is transparent so that the background of the component's container shows through," +
"and the control has no borders." ;
function showOutput()
{
textoutput.text= "Text Format: " + sampleText;
}
function clearText()
{
textoutput.text="";
}
]]>
</mx:Script>
<mx:Panel title="Text Panel" marginTop="10">
<mx:Text id="textoutput" text="Text control output will be displayed here." width="295" height="135"
color="#0000FF"/>
<mx:HBox>
<mx:Button label="Press Enter" click="showOutput();"/>
<mx:Button label="Clear" click="clearText();"/>
</mx:HBox>
</mx:Panel>
</mx:Application>