mx.core

# ITextInput - AS3 Flex

Package | mx.core
Interface | public interface ITextInput extends IDataRenderer , IDropInListItemRenderer , IFocusManagerComponent , IFontContextComponent , IIMESupport , IListItemRenderer , IUIComponent , IInvalidating , IStyleClient , IEventDispatcher , IFlexDisplayObject , ILayoutManagerClient , ISimpleStyleClient , IFlexDisplayObject , ISimpleStyleClient , IBitmapDrawable
Implementors | MXFTETextInput, TextInput

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Defines an interface for a single-line text field that is optionally editable.

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | accessibilityProperties : AccessibilityProperties The current accessibility options for this display object. | IFlexDisplayObject
|  | alpha : Number Indicates the alpha transparency value of the object specified. | IFlexDisplayObject
|  | baselinePosition : Number [read-only] The y-coordinate of the baseline of the first line of text of the component. | IUIComponent
|  | blendMode : String A value from the BlendMode class that specifies which blend mode to use. | IFlexDisplayObject
|  | cacheAsBitmap : Boolean If set to true, Flash runtimes cache an internal bitmap representation of the display object. | IFlexDisplayObject
|  | className : String [read-only] The name of the component class. | IStyleClient
|  | data : Object The data to render or edit. | IDataRenderer
|  | document : Object A reference to the document object associated with this component. | IUIComponent
|  | editable : Boolean Indicates whether the user is allowed to edit the text in this control. | ITextInput
|  | enabled : Boolean Whether the component can accept user interaction. | IUIComponent
|  | enableIME : Boolean [read-only] Specifies whether the IME should be enabled when this component has focus. | IIMESupport
|  | explicitHeight : Number The explicitly specified height for the component, in pixels, as the component's coordinates. | IUIComponent
|  | explicitMaxHeight : Number [read-only] Number that specifies the maximum height of the component, in pixels, as the component's coordinates. | IUIComponent
|  | explicitMaxWidth : Number [read-only] Number that specifies the maximum width of the component, in pixels, as the component's coordinates. | IUIComponent
|  | explicitMinHeight : Number [read-only] Number that specifies the minimum height of the component, in pixels, as the component's coordinates. | IUIComponent
|  | explicitMinWidth : Number [read-only] Number that specifies the minimum width of the component, in pixels, as the component's coordinates. | IUIComponent
|  | explicitWidth : Number The explicitly specified width for the component, in pixels, as the component's coordinates. | IUIComponent
|  | filters : Array An indexed array that contains each filter object currently associated with the display object. | IFlexDisplayObject
|  | focusEnabled : Boolean A flag that indicates whether the component can receive focus when selected. | IFocusManagerComponent
|  | focusPane : Sprite A single Sprite object that is shared among components and used as an overlay for drawing the focus indicator. | IUIComponent
|  | fontContext : IFlexModuleFactory The module factory that provides the font context for this component. | IFontContextComponent
|  | hasFocusableChildren : Boolean A flag that indicates whether child objects can receive focus. | IFocusManagerComponent
|  | height : Number Indicates the height of the display object, in pixels. | IFlexDisplayObject
|  | horizontalScrollPosition : Number Pixel position in the content area of the leftmost pixel that is currently displayed. | ITextInput
|  | imeMode : String The IME mode of the component. | IIMESupport
|  | includeInLayout : Boolean Specifies whether this component is included in the layout of the parent container. | IUIComponent
|  | inheritingStyles : Object An object containing the inheritable styles for this component. | IStyleClient
|  | initialized : Boolean A flag that determines if an object has been through all three phases of layout validation (provided that any were required) This flag should only be modified by the LayoutManager. | ILayoutManagerClient
|  | isPopUp : Boolean Set to true by the PopUpManager to indicate that component has been popped up. | IUIComponent
|  | listData : BaseListData Implements the listData property using setter and getter methods. | IDropInListItemRenderer
|  | loaderInfo : LoaderInfo [read-only] Returns a LoaderInfo object containing information about loading the file to which this display object belongs. | IFlexDisplayObject
|  | mask : DisplayObject The calling display object is masked by the specified mask object. | IFlexDisplayObject
|  | maxChars : int Maximum number of characters that users can enter in the text field. | ITextInput
|  | maxHeight : Number [read-only] Number that specifies the maximum height of the component, in pixels, as the component's coordinates. | IUIComponent
|  | maxWidth : Number [read-only] Number that specifies the maximum width of the component, in pixels, as the component's coordinates. | IUIComponent
|  | measuredHeight : Number [read-only] The measured height of this object. | IFlexDisplayObject
|  | measuredMinHeight : Number The default minimum height of the component, in pixels. | IUIComponent
|  | measuredMinWidth : Number The default minimum width of the component, in pixels. | IUIComponent
|  | measuredWidth : Number [read-only] The measured width of this object. | IFlexDisplayObject
|  | minHeight : Number [read-only] Number that specifies the minimum height of the component, in pixels, as the component's coordinates. | IUIComponent
|  | minWidth : Number [read-only] Number that specifies the minimum width of the component, in pixels, as the component's coordinates. | IUIComponent
|  | mouseChildren : Boolean Determines whether or not the children of the object are mouse, or user input device, enabled. | ITextInput
|  | mouseEnabled : Boolean Specifies whether this object receives mouse, or other user input, messages. | ITextInput
|  | mouseFocusEnabled : Boolean [read-only] A flag that indicates whether the component can receive focus when selected with the mouse. | IFocusManagerComponent
|  | mouseX : Number [read-only] Indicates the x coordinate of the mouse or user input device position, in pixels. | IFlexDisplayObject
|  | mouseY : Number [read-only] Indicates the y coordinate of the mouse or user input device position, in pixels. | IFlexDisplayObject
|  | name : String Indicates the instance name of the DisplayObject. | IFlexDisplayObject
|  | nestLevel : int The top-level SystemManager has a nestLevel of 1. | ILayoutManagerClient
|  | nonInheritingStyles : Object An object containing the noninheritable styles for this component. | IStyleClient
|  | opaqueBackground : Object Specifies whether the display object is opaque with a certain background color. | IFlexDisplayObject
|  | owner : DisplayObjectContainer The owner of this IVisualElement object. | IUIComponent
|  | parent : DisplayObjectContainer [read-only] Indicates the DisplayObjectContainer object that contains this display object. | IFlexDisplayObject
|  | parentDrawsFocus : Boolean If true, calls to this control's drawFocus() method are forwarded to its parent's drawFocus() method. | ITextInput
|  | percentHeight : Number Number that specifies the height of a component as a percentage of its parent's size. | IUIComponent
|  | percentWidth : Number Number that specifies the width of a component as a percentage of its parent's size. | IUIComponent
|  | processedDescriptors : Boolean Set to true after immediate or deferred child creation, depending on which one happens. | ILayoutManagerClient
|  | restrict : String Indicates the set of characters that a user can enter into the control. | ITextInput
|  | root : DisplayObject [read-only] For a display object in a loaded SWF file, the root property is the top-most display object in the portion of the display list's tree structure represented by that SWF file. | IFlexDisplayObject
|  | rotation : Number Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation. | IFlexDisplayObject
|  | scale9Grid : Rectangle The current scaling grid that is in effect. | IFlexDisplayObject
|  | scaleX : Number Indicates the horizontal scale (percentage) of the object as applied from the registration point. | IFlexDisplayObject
|  | scaleY : Number Indicates the vertical scale (percentage) of an object as applied from the registration point of the object. | IFlexDisplayObject
|  | scrollRect : Rectangle The scroll rectangle bounds of the display object. | IFlexDisplayObject
|  | selectable : Boolean A flag indicating whether the text in the TextInput can be selected. | ITextInput
|  | selectionActivePosition : int [read-only] The zero-based index of the position after the last character in the current selection (equivalent to the one-based index of the last character). | ITextInput
|  | selectionAnchorPosition : int [read-only] The zero-based character index value of the first character in the current selection. | ITextInput
|  | stage : Stage [read-only] The Stage of the display object. | IFlexDisplayObject
|  | styleDeclaration : CSSStyleDeclaration The style declaration that holds the inline styles declared by this object. | IStyleClient
|  | styleName : Object The source of this object's style values. | ISimpleStyleClient
|  | systemManager : ISystemManager A reference to the SystemManager object for this component. | IUIComponent
|  | tabFocusEnabled : Boolean [read-only] A flag that indicates whether pressing the Tab key eventually moves focus to this component. | IFocusManagerComponent
|  | tabIndex : int If tabFocusEnabled, the order in which the component receives focus. | IFocusManagerComponent
|  | text : String Plain text that appears in the control. | ITextInput
|  | transform : flash.geom:Transform An object with properties pertaining to a display object's matrix, color transform, and pixel bounds. | IFlexDisplayObject
|  | tweeningProperties : Array Used by EffectManager. | IUIComponent
|  | updateCompletePendingFlag : Boolean A flag that determines if an object is waiting to have its updateComplete event dispatched. | ILayoutManagerClient
|  | visible : Boolean Whether or not the display object is visible. | IFlexDisplayObject
|  | width : Number Indicates the width of the display object, in pixels. | IFlexDisplayObject
|  | x : Number Indicates the x coordinate of the DisplayObject instance relative to the local coordinates of the parent DisplayObjectContainer. | IFlexDisplayObject
|  | y : Number Indicates the y coordinate of the DisplayObject instance relative to the local coordinates of the parent DisplayObjectContainer. | IFlexDisplayObject

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event. | IEventDispatcher
|  | clearStyle(styleProp:String):void Deletes a style property from this component instance. | IStyleClient
|  | dispatchEvent(event:Event):Boolean Dispatches an event into the event flow. | IEventDispatcher
|  | drawFocus(isFocused:Boolean):void Called by the FocusManager when the component receives focus. | IFocusManagerComponent
|  | getBounds(targetCoordinateSpace:DisplayObject):Rectangle Returns a rectangle that defines the area of the display object relative to the coordinate system of the targetCoordinateSpace object. | IFlexDisplayObject
|  | getClassStyleDeclarations():Array Returns an Array of CSSStyleDeclaration objects for the type selector that applies to this component, or null if none exist. | IStyleClient
|  | getExplicitOrMeasuredHeight():Number A convenience method for determining whether to use the explicit or measured height | IUIComponent
|  | getExplicitOrMeasuredWidth():Number A convenience method for determining whether to use the explicit or measured width | IUIComponent
|  | getRect(targetCoordinateSpace:DisplayObject):Rectangle Returns a rectangle that defines the boundary of the display object, based on the coordinate system defined by the targetCoordinateSpace parameter, excluding any strokes on shapes. | IFlexDisplayObject
|  | getStyle(styleProp:String):* Gets a style property that has been set anywhere in this component's style lookup chain. | IStyleClient
|  | globalToLocal(point:Point):Point Converts the point object from the Stage (global) coordinates to the display object's (local) coordinates. | IFlexDisplayObject
|  | hasEventListener(type:String):Boolean Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | IEventDispatcher
|  | hitTestObject(obj:DisplayObject):Boolean Evaluates the bounding box of the display object to see if it overlaps or intersects with the bounding box of the obj display object. | IFlexDisplayObject
|  | hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean Evaluates the display object to see if it overlaps or intersects with the point specified by the x and y parameters. | IFlexDisplayObject
|  | initialize():void Initialize the object. | IUIComponent
|  | invalidateDisplayList():void Calling this method results in a call to the component's validateDisplayList() method before the display list is rendered. | IInvalidating
|  | invalidateProperties():void Calling this method results in a call to the component's validateProperties() method before the display list is rendered. | IInvalidating
|  | invalidateSize():void Calling this method results in a call to the component's validateSize() method before the display list is rendered. | IInvalidating
|  | localToGlobal(point:Point):Point Converts the point object from the display object's (local) coordinates to the Stage (global) coordinates. | IFlexDisplayObject
|  | move(x:Number, y:Number):void Moves this object to the specified x and y coordinates. | IFlexDisplayObject
|  | notifyStyleChangeInChildren(styleProp:String, recursive:Boolean):void Propagates style changes to the children of this component. | IStyleClient
|  | owns(displayObject:DisplayObject):Boolean Returns true if the chain of owner properties points from child to this UIComponent. | IUIComponent
|  | parentChanged(p:DisplayObjectContainer):void Called by Flex when a UIComponent object is added to or removed from a parent. | IUIComponent
|  | regenerateStyleCache(recursive:Boolean):void Sets up the internal style cache values so that the getStyle() method functions. | IStyleClient
|  | registerEffects(effects:Array):void Registers the EffectManager as one of the event listeners for each effect event. | IStyleClient
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void Removes a listener from the EventDispatcher object. | IEventDispatcher
|  | selectRange(anchorPosition:int, activePosition:int):void Selects the text in the range specified by the parameters. | ITextInput
|  | setActualSize(newWidth:Number, newHeight:Number):void Sets the actual size of this object. | IFlexDisplayObject
|  | setFocus():void Called by the FocusManager when the component receives focus. | IFocusManagerComponent
|  | setStyle(styleProp:String, newValue:*):void Sets a style property on this component instance. | IStyleClient
|  | setVisible(value:Boolean, noEvent:Boolean = false):void Called when the visible property changes. | IUIComponent
|  | showBorderAndBackground(visible:Boolean):void Determines whether the border and background of the TextInput are visible. | ITextInput
|  | styleChanged(styleProp:String):void Called when the value of a style property is changed. | ISimpleStyleClient
|  | validateDisplayList():void Validates the position and size of children and draws other visuals. | ILayoutManagerClient
|  | validateNow():void Validates and updates the properties and layout of this object by immediately calling validateProperties(), validateSize(), and validateDisplayList(), if necessary. | IInvalidating
|  | validateProperties():void Validates the properties of a component. | ILayoutManagerClient
|  | validateSize(recursive:Boolean = false):void Validates the measured size of the component If the LayoutManager.invalidateSize() method is called with this ILayoutManagerClient, then the validateSize() method is called when it's time to do measurements. | ILayoutManagerClient
|  | willTrigger(type:String):Boolean Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | IEventDispatcher

Property Detail

### editable

property

`editable:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Indicates whether the user is allowed to edit the text in this control. If `true`, the user can edit the text.

The default value is `true.`

Implementation
`public function get editable():Boolean`
`public function set editable(value:Boolean):void`

### horizontalScrollPosition

property

`horizontalScrollPosition:Number`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Pixel position in the content area of the leftmost pixel that is currently displayed. (The content area includes all contents of a control, not just the portion that is currently displayed.) This property is always set to 0, and ignores changes, if `wordWrap` is set to `true`.

The default value is `0.`

Implementation
`public function get horizontalScrollPosition():Number`
`public function set horizontalScrollPosition(value:Number):void`

### maxChars

property

`maxChars:int`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Maximum number of characters that users can enter in the text field. This property does not limit the length of text specified by the setting the control's `text` or `htmlText` property.

The default value is 0, which is a special case meaning an unlimited number.

Implementation
`public function get maxChars():int`
`public function set maxChars(value:int):void`

### mouseChildren

property

`mouseChildren:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Determines whether or not the children of the object are mouse, or user input device, enabled. If an object is enabled, a user can interact with it by using a mouse or user input device. The default is `true`.

This property is useful when you create a button with an instance of the Sprite class (instead of using the SimpleButton class). When you use a Sprite instance to create a button, you can choose to decorate the button by using the `addChild()` method to add additional Sprite instances. This process can cause unexpected behavior with mouse events because the Sprite instances you add as children can become the target object of a mouse event when you expect the parent instance to be the target object. To ensure that the parent instance serves as the target objects for mouse events, you can set the `mouseChildren` property of the parent instance to `false`.

No event is dispatched by setting this property. You must use the `addEventListener()` method to create interactive functionality.

Implementation
`public function get mouseChildren():Boolean`
`public function set mouseChildren(value:Boolean):void`

### mouseEnabled

property

`mouseEnabled:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Specifies whether this object receives mouse, or other user input, messages. The default value is `true`, which means that by default any InteractiveObject instance that is on the display list receives mouse events or other user input events. If `mouseEnabled` is set to `false`, the instance does not receive any mouse events (or other user input events like keyboard events). Any children of this instance on the display list are not affected. To change the `mouseEnabled` behavior for all children of an object on the display list, use `flash.display.DisplayObjectContainer.mouseChildren`.

No event is dispatched by setting this property. You must use the `addEventListener()` method to create interactive functionality.

Implementation
`public function get mouseEnabled():Boolean`
`public function set mouseEnabled(value:Boolean):void`

### parentDrawsFocus

property

`parentDrawsFocus:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

If true, calls to this control's `drawFocus()` method are forwarded to its parent's `drawFocus()` method. This is used when a TextInput is part of a composite control like NumericStepper or ComboBox;

The default value is `false.`

Implementation
`public function get parentDrawsFocus():Boolean`
`public function set parentDrawsFocus(value:Boolean):void`

### restrict

property

`restrict:String`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Indicates the set of characters that a user can enter into the control. If the value of the `restrict` property is `null`, you can enter any character. If the value of the `restrict` property is an empty string, you cannot 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.

Flex scans the string from left to right. You can specify a range by using the hyphen (-) character. If the string begins with a caret (^) character, all characters are initially accepted and succeeding characters in the string are excluded from the set of accepted characters. If the string does not begin with a caret (^) character, no characters are initially accepted and succeeding characters in the string are included in the set of accepted characters.

Because some characters have a special meaning when used in the `restrict` property, you must use backslash characters to specify the literal characters -, ^, and \. When you use the `restrict` property as an attribute in an MXML tag, use single backslashes, as in the following example: \^\-\\. When you set the `restrict` In and ActionScript expression, use double backslashes, as in the following example: \\^\\-\\\.

The default value is `null.`

Implementation
`public function get restrict():String`
`public function set restrict(value:String):void`

Related API Elements

flash.text.TextField.restrict

### selectable

property

`selectable:Boolean`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

A flag indicating whether the text in the TextInput can be selected.

Implementation
`public function get selectable():Boolean`
`public function set selectable(value:Boolean):void`

### selectionActivePosition

property

`selectionActivePosition:int` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

The zero-based index of the position after the last character in the current selection (equivalent to the one-based index of the last character). If the last character in the selection, for example, is the fifth character, this property has the value 5. When the control gets the focus, the selection is visible if the `selectionAnchorIndex` and `selectionActiveIndex` properties are both set.

The default value is `0.`

Implementation
`public function get selectionActivePosition():int`

### selectionAnchorPosition

property

`selectionAnchorPosition:int` [read-only]

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

The zero-based character index value of the first character in the current selection. For example, the first character is 0, the second character is 1, and so on. When the control gets the focus, the selection is visible if the `selectionAnchorIndex` and `selectionActiveIndex` properties are both set.

The default value is `0.`

Implementation
`public function get selectionAnchorPosition():int`

### text

property

`text:String`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Plain text that appears in the control. Its appearance is determined by the CSS styles of this Label control.

Any HTML tags in the text string are ignored, and appear as entered in the string. To display text formatted using HTML tags, use the `htmlText` property instead. If you set the `htmlText` property, the HTML replaces any text you had set using this propety, and the `text` property returns a plain-text version of the HTML text, with all HTML tags stripped out. For more information see the `htmlText` property.

To include the special characters left angle bracket (<), right angle bracket (>), or ampersand (&) in the text, wrap the text string in the CDATA tag. Alternatively, you can use HTML character entities for the special characters, for example, `<`.

If you try to set this property to `null`, it is set, instead, to the empty string. The `text` property can temporarily have the value `null`, which indicates that the `htmlText` has been recently set and the corresponding `text` value has not yet been determined.

The default value is `"".`

Implementation
`public function get text():String`
`public function set text(value:String):void`
Method Detail

### selectRange

()
method

`public function selectRange(anchorPosition:int, activePosition:int):void`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Selects the text in the range specified by the parameters.

Parameters

| `anchorPosition:int` — The zero-based character index value of the first character in the current selection.
| `activePosition:int` — The zero-based index of the position after the last character in the current selection (equivalent to the one-based index of the last character).

### showBorderAndBackground

()
method

`public function showBorderAndBackground(visible:Boolean):void`

Language Version: | ActionScript 3.0

Product Version: | Flex 4

Runtime Versions: | Flash Player 10, AIR 1.5

Determines whether the border and background of the TextInput are visible.

Parameters

| `visible:Boolean` — `true` if visible, and `false` if not.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00