Methods | Properties | Effects | Events | Styles | Examples Frames | No Frames

mx.controls
Class Text

Inheritance ImageInheritance Image


class Text
extends mx.controls.Label

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:

 <mx:Text
marginTop="0"
marginBottom="0"
selectable="true|false"
/>

Click here to view the Examples

See Also
    Label
    TextInput
    TextArea



Methods

Methods inherited from class mx.core.UIObject
addEventListener   applyProperties   buildDepthTable   commitProperties   constructObject2   createAccessibilityImplementation   createChildAtDepth   createChildren   createClassChildAtDepth   createClassObject   createEmptyObject   destroyObject   dispatchEvent   doLater   draw   drawRect   executeBindings   fillRect   findNextAvailableDepth   getRepeaterItem   getStyle   handleEvent   init   invalidate   invalidateLayout   invalidateProperties   invalidateSize   invalidateStyle   layoutChildren   measure   move   redraw   removeEventListener   setDepthAbove   setDepthBelow   setMask   setSize   setSizeNoLayout   setStyle   swapDepths  



Properties
       className: String
Name of this class.
       selectable: Boolean
Specifies whether the text can be selected, true, or not, false.
staticversion: String
Version string for this class.

Properties inherited from class mx.controls.Label
className   htmlText   text   version  

Properties inherited from class mx.core.UIObject
alpha   baselinePosition   className   depth   documentDescriptor   height   heightFlex   id   instanceIndices   isDocument   kStretch   layoutHeight   layoutWidth   maxHeight   maxWidth   minHeight   minWidth   mouseX   mouseY   nestLevel   oldHeight   oldWidth   oldX   oldY   parent   parentApplication   parentDocument   percentHeight   percentWidth   preferredHeight   preferredWidth   repeaterIndices   scaleX   scaleY   styleName   tabEnabled   toolTip   version   visible   width   widthFlex   x   y  



Effects

Effects inherited from class mx.core.UIObject
creationCompleteEffect   hideEffect   mouseDownEffect   mouseOutEffect   mouseOverEffect   mouseUpEffect   moveEffect   resizeEffect   showEffect  



Events

Events inherited from class: mx.controls.Label
hide  show 

Events inherited from class: mx.core.UIObject
creationComplete  dragComplete  dragDrop  dragEnter  dragExit  dragOver  draw  effectEnd  effectStart  hide  hideToolTip  initialize  load  mouseChangeSomewhere  mouseDown  mouseDownSomewhere  mouseMove  mouseMoveSomewhere  mouseOut  mouseOver  mouseUp  mouseUpSomewhere  move  resize  show  showToolTip  unload 



Styles
marginBottom Type: Number   Format: Length   CSS Inheritance: no
Number of pixels between the control's bottom border and its content area. The default value is 0.
marginTop Type: Number   Format: Length   CSS Inheritance: no
Number of pixels between the control's top border and its content area. The default value is 0.

Styles inherited from class mx.controls.Label
disabledColor  

Styles inherited from class mx.core.UIObject
color   fontFamily   fontSize   fontStyle   fontWeight   horizontalGap   leading   marginLeft   marginRight   textAlign   textDecoration   textIndent   verticalGap  



Property Detail

className

className: String  

Name of this class.


selectable

selectable: Boolean  

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>




 

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

Current page: http://livedocs.adobe.com/flex/15/asdocs_en/mx/controls/Text.html