mx.controls
Class TextInput



class TextInput
extends mx.core.UIComponent

The TextInput control is a single-line text field that is optionally editable. All text in the TextInput control must use the same styling unless it is HTML text. The TextInput control supports the HTML rendering capabilities of the Macromedia Flash Player. The TextInput control, like other input and choice controls, can have a required value indicator when used in a FormItem control in a Form container.

TextInput controls do not include a label, although you can add one by using a Label control or by nesting the TextInput control in a FormItem control in a Form container. TextInput controls indicate whether a value is required. TextInput controls have a number of states, including filled, selected, disabled, and error. TextInput controls support formatting, validation, keyboard equivalents; they also broadcast change and enter events.

If you disable a TextInput control, it displays contents in a different color, represented by the disabledColor style. To disallow editing the text, you set the editable property to false. To conceal the input text by displaying asterisks instead of the characters entered, you set a TextInput control`s password property.

MXML Syntax

The <mx:TextInput> tag inherits all the properties of its parent classes, and the following properties:

 <mx:TextInput
editable="true|false"
hPosition="0"
htmlText="No default."
maxChars="undefined"
maxHPosition="0"
password="false|true"
restrict="null"
text="No default."
borderStyle="inset|solid|none|outset"
change="Event handler; no default."
enter="Event handler; no default."
/>

See Also
mx.controls.TextArea



Methods

Methods inherited from class mx.core.UIComponent
getFocus  setFocus  getFocusManager 

Methods inherited from class mx.core.UIObject
createAccessibilityImplementation  measure  doLater  cancelAllDoLaters  invalidate  invalidateStyle  invalidateProperties  invalidateSize  redraw  move  setSize  setSizeNoLayout  drawRect  fillRect  destroyLabel  createClassObject  createEmptyObject  destroyObject  getStyle  setMask  swapDepths 


Properties
staticversion:String  
ComponentVersion is for internal use only.
      className:String  
Name of this class.
      html:Boolean   [Read-Write]
If true, text is supplied as HTML.
      text:String   [Read-Write]
Text string that appears in the control.
      htmlText:String   [Read-Write]
Contains HTML formatted text.
      maxChars:Number   [Read-Write]
Maximum number of characters that the text field can contain.
      length:Number   [Read-Only]
Length of text in the component.
      restrict:String   [Read-Write]
Set of characters that a user can enter into the text field.
      hPosition:Number   [Read-Write]
Pixel position of the left-most character that is currently displayed.
      maxHPosition:Number   [Read-Only]
Maximum value of hPosition.
      editable:Boolean   [Read-Write]
If true, the user can edit the text.
      password:Boolean   [Read-Write]
Whether the field is a password field, true or not, false.
      tabIndex:Number   [Read-Write]
Tab order for navigating with the tab key.

Properties inherited from class mx.core.UIComponent
version  enabled  tabIndex 

Properties inherited from class mx.core.UIObject
version  nestLevel  dispatchEvent  addEventListener  handleEvent  removeEventListener  kStretch  styleName  className  setStyle  parentApplication  isDocument  parentDocument  documentDescriptor  descriptor  instanceIndices  repeaterIndices  getRepeaterItem  id  width  height  x  y  minHeight  minWidth  preferredHeight  preferredWidth  maxHeight  maxWidth  widthFlex  heightFlex  visible  scaleX  scaleY  alpha  depth  mouseX  mouseY  toolTip  baselinePosition 


Effects

Effects inherited from class mx.core.UIComponent
showEffect  hideEffect  focusInEffect  focusOutEffect 

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


Events
changeHandler for change events, which are broadcast when text in the TextInput control changes. Target contains a reference to the component that triggered the event. Type contains the name of the event.
enterHandler for enter events, which are broadcast when the user presses the Enter key. Target contains a reference to the component that triggered the event. Type contains the name of the event.

Events inherited from class: mx.core.UIComponent
focusIn  focusOut  keyDown  keyUp  show  hide  valid  invalid  valueCommitted 

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


Styles
disabledColor Type: Number   Format: Color   CSS Inheritance: yes
Disabled color of the TextInput.

Styles inherited from class mx.core.UIComponent
backgroundColor  backgroundDisabledColor  backgroundImage  backgroundAlpha  backgroundSize  barColor  borderCapColor  borderColor  buttonColor  borderStyle  disabledColor  errorColor  highlightColor  lineHeight  modalTransparency  scrollTrackColor  shadowColor  shadowCapColor  symbolColor  symbolBackgroundColor  symbolBackgroundDisabledColor  symbolBackgroundPressedColor  symbolDisabledColor  themeColor 

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


Property Detail

className

className:String  

Name of this class.


editable

editable:Boolean   [Read-Write]

If true, the user can edit the text. The default value is true.


hPosition

hPosition:Number   [Read-Write]

Pixel position of the left-most character that is currently displayed. The default value is 0.


html

html:Boolean   [Read-Write]

If true, text is supplied as HTML.


htmlText

htmlText:String   [Read-Write]

Contains HTML formatted text. If your text string contains HTML tags, you must wrap it in the CDATA tag. The control collapses any white-space characters, such as tab and newline characters. For the special characters left angle bracket (<), right angle bracket (>), or ampersand (&), insert the HTML equivalents of &lt;, &gt;, and &amp;. The htmlText property ignores CSS style settings for the control, and instead relies on the HTML tags in the string for formatting.


length

length:Number   [Read-Only]

Length of text in the component.


maxChars

maxChars:Number   [Read-Write]

Maximum number of characters that the text field can contain. The default value is undefined.


maxHPosition

maxHPosition:Number   [Read-Only]

Maximum value of hPosition. The default value is 0.


password

password:Boolean   [Read-Write]

Whether the field is a password field, true or not, false. The default value is false. If you set this property to true, each text character entered into the control appears as the character " ".


restrict

restrict:String   [Read-Write]

Set of characters that a user can enter into the text field. If the value of the restrict property is null or an empty string, you can enter any character. This property only restricts user interaction; a script can put any text into the text field. If the value of the restrict property is a string of characters, you may enter only characters in that string into the text field. The string is scanned from left to right. A range may be specified using the dash (-). If the string begins with ^, the string specifies the characters that may not be entered into the control. For example, the string "^a-z" means all upper case letters may be entered, but no lower case letters are allowed. This property does not synchronize with the Embed Font Outlines check boxes in the Property inspector. Since some characters have a special meaning when used in the restrict property, you must use the backslash character to specify the literal characters -, ^, and \, as in the following:
\^
\-
\\


tabIndex

tabIndex:Number   [Read-Write]

Tab order for navigating with the tab key.


text

text:String   [Read-Write]

Text string that appears in the control. The control collapses any white-space characters, such as tab and newline characters. Any HTML tags in the text string are ignored, and appear as entered in the string. For the special characters left angle bracket (<), right angle bracket (>), or ampersand (&), wrap the text string in the CDATA tag. If html="false," it contains plain text. If html="true," it contains HTML formatted text, including HTML tags.


version

static version:String  

ComponentVersion is for internal use only.