ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Show Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes
spark.core 

IEditableText  - AS3 Flex

Packagespark.core
Interfacepublic interface IEditableText extends IDisplayText , IEventDispatcher
Implementors RichEditableText, StyleableStageText, StyleableTextField

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

The IEditableText interface defines the properties and methods for editable text.



Public Properties
 PropertyDefined By
  accessibilityProperties : AccessibilityProperties
The current accessibility options for this display object.
IEditableText
  displayAsPassword : Boolean
Specifies whether the text field is a password text field.
IEditableText
  editable : Boolean
Flag that indicates whether the text is editable.
IEditableText
  enabled : Boolean
Whether the component can accept user interaction.
IEditableText
  focusEnabled : Boolean
Indicates whether the component can receive focus when tabbed to.
IEditableText
  horizontalScrollPosition : Number
The horizontal scroll position of the text.
IEditableText
 InheritedisTruncated : Boolean
[read-only] A flag that indicates whether the text has been truncated.
IDisplayText
  lineBreak : String
Controls word wrapping within the text.
IEditableText
  maxChars : int
The maximum number of characters that the text field can contain, as entered by a user.
IEditableText
  multiline : Boolean
Indicates whether field is a multiline text field.
IEditableText
  restrict : String
Indicates the set of characters that a user can enter into the text field.
IEditableText
  selectable : Boolean
A Boolean value that indicates whether the text field is selectable.
IEditableText
  selectionActivePosition : int
[read-only] The active, or last clicked position, of the selection.
IEditableText
  selectionAnchorPosition : int
[read-only] The anchor, or first clicked position, of the selection.
IEditableText
  tabIndex : int
Specifies the tab ordering of objects in a SWF file.
IEditableText
 Inheritedtext : String
The text displayed by this text component.
IDisplayText
  verticalScrollPosition : Number
The vertical scroll position of the text.
IEditableText
Public Methods
 MethodDefined By
 Inherited
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
  
Appends the specified text to the end of the text component, as if you had clicked at the end and typed.
IEditableText
 Inherited
Dispatches an event into the event flow.
IEventDispatcher
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
IEventDispatcher
  
Inserts the specified text into the text component as if you had typed it.
IEditableText
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
IEventDispatcher
  
scrollToRange(anchorPosition:int, activePosition:int):void
Scroll so the specified range is in view.
IEditableText
  
Selects all of the text.
IEditableText
  
selectRange(anchorIndex:int, activeIndex:int):void
Selects a specified range of characters.
IEditableText
  
Set focus to this text field.
IEditableText
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
IEventDispatcher
Property Detail

accessibilityProperties

property
accessibilityProperties:AccessibilityProperties

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

The current accessibility options for this display object. If you modify the accessibilityProperties property or any of the fields within accessibilityProperties, you must call the Accessibility.updateProperties() method to make your changes take effect.

Note: For an object created in the Flash authoring environment, the value of accessibilityProperties is prepopulated with any information you entered in the Accessibility panel for that object.



Implementation
    public function get accessibilityProperties():AccessibilityProperties
    public function set accessibilityProperties(value:AccessibilityProperties):void

displayAsPassword

property 
displayAsPassword:Boolean

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Specifies whether the text field is a password text field. If the value of this property is true, the text field is treated as a password text field and hides the input characters using asterisks instead of the actual characters. If false, the text field is not treated as a password text field. When password mode is enabled, the Cut and Copy commands and their corresponding keyboard shortcuts will not function. This security mechanism prevents an unscrupulous user from using the shortcuts to discover a password on an unattended computer.



Implementation
    public function get displayAsPassword():Boolean
    public function set displayAsPassword(value:Boolean):void

editable

property 
editable:Boolean

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Flag that indicates whether the text is editable.

The default value is false.



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

enabled

property 
enabled:Boolean

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Whether the component can accept user interaction. After setting the enabled property to false, some components still respond to mouse interactions such as mouseOver. As a result, to fully disable UIComponents, you should also set the value of the mouseEnabled property to false. If you set the enabled property to false for a container, Flex dims the color of the container and of all of its children, and blocks user input to the container and to all of its children.



Implementation
    public function get enabled():Boolean
    public function set enabled(value:Boolean):void

focusEnabled

property 
focusEnabled:Boolean

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Indicates whether the component can receive focus when tabbed to. You can set focusEnabled to false when a UIComponent is used as a subcomponent of another component so that the outer component becomes the focusable entity. If this property is false, focus is transferred to the first parent that has focusEnable set to true.

The default value is true, except for the spark.components.Scroller component. For that component, the default value is false.



Implementation
    public function get focusEnabled():Boolean
    public function set focusEnabled(value:Boolean):void

horizontalScrollPosition

property 
horizontalScrollPosition:Number

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

The horizontal scroll position of the text.



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

lineBreak

property 
lineBreak:String

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Controls word wrapping within the text. This property corresponds to the lineBreak style.



Implementation
    public function get lineBreak():String
    public function set lineBreak(value:String):void

Related API Elements

maxChars

property 
maxChars:int

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

The maximum number of characters that the text field can contain, as entered by a user. A script can insert more text than maxChars allows; the maxChars property indicates only how much text a user can enter. If the value of this property is 0, a user can enter an unlimited amount of text.



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

multiline

property 
multiline:Boolean

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Indicates whether field is a multiline text field. If the value is true, the text field is multiline; if the value is false, the text field is a single-line text field. In a field of type TextFieldType.INPUT, the multiline value determines whether the Enter key creates a new line (a value of false, and the Enter key is ignored). If you paste text into a TextField with a multiline value of false, newlines are stripped out of the text.



Implementation
    public function get multiline():Boolean
    public function set multiline(value:Boolean):void

restrict

property 
restrict:String

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Indicates the set of characters that a user can enter into the text field. 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. If the value of the restrict property is a string of characters, you can enter only characters in the string into the text field. The string is scanned from left to right. You can specify a range by using the hyphen (-) character. Only user interaction is restricted; a script can put any text into the text field. This property does not synchronize with the Embed font options in the Property inspector.

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.

The following example allows only uppercase characters, spaces, and numbers to be entered into a text field:

     my_txt.restrict = "A-Z 0-9";
     

The following example includes all characters, but excludes lowercase letters:

     my_txt.restrict = "^a-z";
     

You can use a backslash to enter a ^ or - verbatim. The accepted backslash sequences are \-, \^ or \\. The backslash must be an actual character in the string, so when specified in ActionScript, a double backslash must be used. For example, the following code includes only the dash (-) and caret (^):

     my_txt.restrict = "\\-\\^";
     

The ^ can be used anywhere in the string to toggle between including characters and excluding characters. The following code includes only uppercase letters, but excludes the uppercase letter Q:

     my_txt.restrict = "A-Z^Q";
     

You can use the \u escape sequence to construct restrict strings. The following code includes only the characters from ASCII 32 (space) to ASCII 126 (tilde).

     my_txt.restrict = "\u0020-\u007E";
     


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

selectable

property 
selectable:Boolean

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

A Boolean value that indicates whether the text field is selectable. The value true indicates that the text is selectable. The selectable property controls whether a text field is selectable, not whether a text field is editable. A dynamic text field can be selectable even if it is not editable. If a dynamic text field is not selectable, the user cannot select its text.

If selectable is set to false, the text in the text field does not respond to selection commands from the mouse or keyboard, and the text cannot be copied with the Copy command. If selectable is set to true, the text in the text field can be selected with the mouse or keyboard, and the text can be copied with the Copy command. You can select text this way even if the text field is a dynamic text field instead of an input text field.



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.5
Runtime Versions: Flash Player 10.1, AIR 2.0

The active, or last clicked position, of the selection. If the implementation does not support selection anchor this is the last character of the selection.



Implementation
    public function get selectionActivePosition():int

selectionAnchorPosition

property 
selectionAnchorPosition:int  [read-only]

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

The anchor, or first clicked position, of the selection. If the implementation does not support selection anchor this is the first character of the selection.



Implementation
    public function get selectionAnchorPosition():int

tabIndex

property 
tabIndex:int

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Specifies the tab ordering of objects in a SWF file. The tabIndex property is -1 by default, meaning no tab index is set for the object.

If any currently displayed object in the SWF file contains a tabIndex property, automatic tab ordering is disabled, and the tab ordering is calculated from the tabIndex properties of objects in the SWF file. The custom tab ordering includes only objects that have tabIndex properties.

The tabIndex property can be a non-negative integer. The objects are ordered according to their tabIndex properties, in ascending order. An object with a tabIndex value of 1 precedes an object with a tabIndex value of 2. Do not use the same tabIndex value for multiple objects.

The custom tab ordering that the tabIndex property defines is flat. This means that no attention is paid to the hierarchical relationships of objects in the SWF file. All objects in the SWF file with tabIndex properties are placed in the tab order, and the tab order is determined by the order of the tabIndex values.

Note: To set the tab order for TLFTextField instances, cast the display object child of the TLFTextField as an InteractiveObject, then set the tabIndex property. For example:

	 InteractiveObject(tlfInstance.getChildAt(1)).tabIndex = 3;
	 
To reverse the tab order from the default setting for three instances of a TLFTextField object (tlfInstance1, tlfInstance2 and tlfInstance3), use:
	 InteractiveObject(tlfInstance1.getChildAt(1)).tabIndex = 3;
	 InteractiveObject(tlfInstance2.getChildAt(1)).tabIndex = 2;
	 InteractiveObject(tlfInstance3.getChildAt(1)).tabIndex = 1;
	 


Implementation
    public function get tabIndex():int
    public function set tabIndex(value:int):void

verticalScrollPosition

property 
verticalScrollPosition:Number

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

The vertical scroll position of the text.



Implementation
    public function get verticalScrollPosition():Number
    public function set verticalScrollPosition(value:Number):void
Method Detail

appendText

()method
public function appendText(text:String):void

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Appends the specified text to the end of the text component, as if you had clicked at the end and typed.

An insertion point is then set after the new text. If necessary, the text will scroll to ensure that the insertion point is visible.

Parameters

text:String — The text to be appended.

insertText

()method 
public function insertText(text:String):void

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Inserts the specified text into the text component as if you had typed it.

If a range was selected, the new text replaces the selected text. If there was an insertion point, the new text is inserted there.

An insertion point is then set after the new text. If necessary, the text will scroll to ensure that the insertion point is visible.

Parameters

text:String — The text to be inserted.

scrollToRange

()method 
public function scrollToRange(anchorPosition:int, activePosition:int):void

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Scroll so the specified range is in view.

Parameters

anchorPosition:int — The anchor position of the selection range.
 
activePosition:int — The active position of the selection range.

selectAll

()method 
public function selectAll():void

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Selects all of the text.

selectRange

()method 
public function selectRange(anchorIndex:int, activeIndex:int):void

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Selects a specified range of characters.

If either position is negative, it will deselect the text range.

Parameters

anchorIndex:int — The character position specifying the end of the selection that stays fixed when the selection is extended.
 
activeIndex:int — The character position specifying the end of the selection that moves when the selection is extended.

setFocus

()method 
public function setFocus():void

Language Version: ActionScript 3.0
Product Version: Flex 4.5
Runtime Versions: Flash Player 10.1, AIR 2.0

Set focus to this text field.