用于 Adobe® Flash® Platform 的 ActionScript® 3.0 参考
主页  |  隐藏包列表和类列表 |   |   |  新增内容  |  索引  |  附录  |  为什么显示为英语?
过滤条件: 正在从服务器检索数据...
正在从服务器检索数据...
mx.core 

ITextInput  - AS3 Flex

mx.core
接口public interface ITextInput extends IDataRenderer , IDropInListItemRenderer , IFocusManagerComponent , IFontContextComponent , IIMESupport , IListItemRenderer , IUIComponent , IInvalidating , IStyleClient , IEventDispatcher , IFlexDisplayObject , ILayoutManagerClient , ISimpleStyleClient , IFlexDisplayObject , ISimpleStyleClient , IBitmapDrawable
实现器 MXFTETextInput, TextInput

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

为可选择编辑的单行文本字段定义一个接口。



公共属性
 属性由以下参数定义
 InheritedaccessibilityProperties : AccessibilityProperties
此显示对象的当前辅助功能选项。
IFlexDisplayObject
 Inheritedalpha : Number
表示指定对象的 Alpha 透明度值。
IFlexDisplayObject
 InheritedbaselinePosition : Number
[只读] 组件第一行文本的基线的 y 坐标。
IUIComponent
 InheritedblendMode : String
BlendMode 类中的一个值,用于指定要使用的混合模式。
IFlexDisplayObject
 InheritedcacheAsBitmap : Boolean
如果设置为 true,则 Flash 运行时将缓存显示对象的内部位图表示形式。
IFlexDisplayObject
 InheritedclassName : String
[只读] 组件类的名称。
IStyleClient
 Inheriteddata : Object
要呈示或编辑的数据。
IDataRenderer
 Inheriteddocument : Object
对与此组件关联的文档对象的引用。
IUIComponent
  editable : Boolean
指示用户是否可以编辑此控件中的文本。
ITextInput
 Inheritedenabled : Boolean
组件是否可以接受用户交互。
IUIComponent
 InheritedenableIME : Boolean
[只读] 指定当该组件获得焦点时,是否应启用 IME。
IIMESupport
 InheritedexplicitHeight : Number
在组件坐标中显式指定的组件高度(以像素为单位)。
IUIComponent
 InheritedexplicitMaxHeight : Number
[只读] 在组件坐标中指定组件最大高度的数字(以像素为单位)。
IUIComponent
 InheritedexplicitMaxWidth : Number
[只读] 在组件坐标中指定组件最大宽度的数字(以像素为单位)。
IUIComponent
 InheritedexplicitMinHeight : Number
[只读] 在组件坐标中指定组件最小高度的数字(以像素为单位)。
IUIComponent
 InheritedexplicitMinWidth : Number
[只读] 在组件坐标中指定组件最小宽度的数字(以像素为单位)。
IUIComponent
 InheritedexplicitWidth : Number
在组件坐标中显式指定的组件宽度(以像素为单位)。
IUIComponent
 Inheritedfilters : Array
包含当前与显示对象关联的每个滤镜对象的索引数组。
IFlexDisplayObject
 InheritedfocusEnabled : Boolean
一个标志,用于指示组件处于选中状态时是否可以获得焦点。
IFocusManagerComponent
 InheritedfocusPane : Sprite
在组件中共享并用作绘制焦点指示符的叠加层的单个 Sprite 对象。
IUIComponent
 InheritedfontContext : IFlexModuleFactory
为此组件提供字体上下文的模块工厂。
IFontContextComponent
 InheritedhasFocusableChildren : Boolean
一个标志,指示子对象是否能够获得焦点。
IFocusManagerComponent
 Inheritedheight : Number
表示显示对象的高度,以像素为单位。
IFlexDisplayObject
  horizontalScrollPosition : Number
当前显示的最左端像素的内容区域中的像素位置。
ITextInput
 InheritedimeMode : String
组件的 IME 模式。
IIMESupport
 InheritedincludeInLayout : Boolean
指定此组件是否包含在父容器的布局中。
IUIComponent
 InheritedinheritingStyles : Object
包含此组件的可继承样式的对象。
IStyleClient
 Inheritedinitialized : Boolean
一个标志,用于确定某个对象是否已完全通过了布局验证的三个阶段(假设每一阶段都是必需的)。此标志应只能由 LayoutManager 修改。
ILayoutManagerClient
 InheritedisPopUp : Boolean
PopUpManager 将其设置为 true 以指示已弹出该组件。
IUIComponent
 InheritedlistData : BaseListData
使用 setter 和 getter 方法实现 listData 属性。
IDropInListItemRenderer
 InheritedloaderInfo : LoaderInfo
[只读] 返回一个 LoaderInfo 对象,其中包含加载此显示对象所属的文件的相关信息。
IFlexDisplayObject
 Inheritedmask : DisplayObject
调用显示对象被指定的 mask 对象遮罩。
IFlexDisplayObject
  maxChars : int
用户可以在文本字段中输入的最大字符数。
ITextInput
 InheritedmaxHeight : Number
[只读] 在组件坐标中指定组件最大高度的数字(以像素为单位)。
IUIComponent
 InheritedmaxWidth : Number
[只读] 在组件坐标中指定组件最大宽度的数字(以像素为单位)。
IUIComponent
 InheritedmeasuredHeight : Number
[只读] 此对象的测量高度。
IFlexDisplayObject
 InheritedmeasuredMinHeight : Number
组件的默认最小高度(以像素为单位)。
IUIComponent
 InheritedmeasuredMinWidth : Number
组件的默认最小宽度(以像素为单位)。
IUIComponent
 InheritedmeasuredWidth : Number
[只读] 此对象的测量宽度。
IFlexDisplayObject
 InheritedminHeight : Number
[只读] 在组件坐标中指定组件最小高度的数字(以像素为单位)。
IUIComponent
 InheritedminWidth : Number
[只读] 在组件坐标中指定组件最小宽度的数字(以像素为单位)。
IUIComponent
  mouseChildren : Boolean
确定对象的子级是否支持鼠标或用户输入设备。
ITextInput
  mouseEnabled : Boolean
指定此对象是否接收鼠标或其他用户输入、消息。
ITextInput
 InheritedmouseFocusEnabled : Boolean
[只读] 一个标志,用于当使用鼠标选中组件时组件是否可以获得焦点。
IFocusManagerComponent
 InheritedmouseX : Number
[只读] 表示此鼠标或用户输入设备位置的 x 坐标,以像素为单位。
IFlexDisplayObject
 InheritedmouseY : Number
[只读] 表示此鼠标或用户输入设备位置的 y 坐标,以像素为单位。
IFlexDisplayObject
 Inheritedname : String
表示 DisplayObject 的实例名称。
IFlexDisplayObject
 InheritednestLevel : int
顶级 SystemManager 的 nestLevel 为 1。
ILayoutManagerClient
 InheritednonInheritingStyles : Object
包含此组件的不可继承样式的对象。
IStyleClient
 InheritedopaqueBackground : Object
指定显示对象是否由于具有某种背景颜色而不透明。
IFlexDisplayObject
 Inheritedowner : DisplayObjectContainer
此 IVisualElement 对象的所有者。
IUIComponent
 Inheritedparent : DisplayObjectContainer
[只读] 表示包含此显示对象的 DisplayObjectContainer 对象。
IFlexDisplayObject
  parentDrawsFocus : Boolean
如果为 true,则调用此控件的 drawFocus() 方法会转到其父项的 drawFocus() 方法上。
ITextInput
 InheritedpercentHeight : Number
以组件父项大小百分比的方式指定组件高度的数字。
IUIComponent
 InheritedpercentWidth : Number
以组件父项大小百分比形式指定其宽度的数字。
IUIComponent
 InheritedprocessedDescriptors : Boolean
临时或延迟子项创建操作后设置为 true,具体取决于发生对象。
ILayoutManagerClient
  restrict : String
指示用户可以输入到控件的字符集。
ITextInput
 Inheritedroot : DisplayObject
[只读] 对于加载的 SWF 文件中的显示对象,root 属性是此 SWF 文件所表示的显示列表树结构部分中的顶级显示对象。
IFlexDisplayObject
 Inheritedrotation : Number
表示 DisplayObject 实例距其原始方向的旋转程度,以度为单位。
IFlexDisplayObject
 Inheritedscale9Grid : Rectangle
当前有效的缩放网格。
IFlexDisplayObject
 InheritedscaleX : Number
表示从注册点开始应用的对象的水平缩放比例(百分比)。
IFlexDisplayObject
 InheritedscaleY : Number
表示从对象注册点开始应用的对象的垂直缩放比例(百分比)。
IFlexDisplayObject
 InheritedscrollRect : Rectangle
显示对象的滚动矩形范围。
IFlexDisplayObject
  selectable : Boolean
一个标志,指示是否可以选择 TextInput 中的文本。
ITextInput
  selectionActivePosition : int
[只读] 当前所选内容中最后一个字符后的位置从零开始的索引(与最后一个字符的从一开始的索引相等)。
ITextInput
  selectionAnchorPosition : int
[只读] 当前所选内容中第一个字符从零开始的字符索引值。
ITextInput
 Inheritedstage : Stage
[只读] 显示对象的舞台。
IFlexDisplayObject
 InheritedstyleDeclaration : CSSStyleDeclaration
具有此对象声明的内嵌样式的样式声明。
IStyleClient
 InheritedstyleName : Object
该对象的样式值的源。
ISimpleStyleClient
 InheritedsystemManager : ISystemManager
对此组件的 SystemManager 对象的引用。
IUIComponent
 InheritedtabFocusEnabled : Boolean
[只读] 一个标志,指示通过按 Tab 键最终是否能够将焦点移动到此组件。
IFocusManagerComponent
 InheritedtabIndex : int
如果 tabFocusEnabled 为 true,则为组件获得焦点的顺序。
IFocusManagerComponent
  text : String
控件中出现的纯文本。
ITextInput
 Inheritedtransform : flash.geom:Transform
一个对象,具有与显示对象的矩阵、颜色转换和像素范围有关的属性。
IFlexDisplayObject
 InheritedtweeningProperties : Array
由 EffectManager 使用。
IUIComponent
 InheritedupdateCompletePendingFlag : Boolean
一个标志,用于确定某个对象是否正在等待调度其 updateComplete 事件。
ILayoutManagerClient
 Inheritedvisible : Boolean
显示对象是否可见。
IFlexDisplayObject
 Inheritedwidth : Number
表示显示对象的宽度,以像素为单位。
IFlexDisplayObject
 Inheritedx : Number
表示 DisplayObject 实例相对于父级 DisplayObjectContainer 本地坐标的 x 坐标。
IFlexDisplayObject
 Inheritedy : Number
表示 DisplayObject 实例相对于父级 DisplayObjectContainer 本地坐标的 y 坐标。
IFlexDisplayObject
公共方法
 方法由以下参数定义
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。
IEventDispatcher
 Inherited
删除此组件实例的样式属性。
IStyleClient
 Inherited
将事件调度到事件流中。
IEventDispatcher
 Inherited
当组件获得焦点时,由 FocusManager 调用。
IFocusManagerComponent
 Inherited
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
返回一个矩形,该矩形定义相对于 targetCoordinateSpace 对象坐标系的显示对象区域。
IFlexDisplayObject
 Inherited
为应用于该组件的类型选择器返回 CSSStyleDeclaration 对象数组,如果不存在则返回 null。
IStyleClient
 Inherited
确定是使用显式高度还是测量高度的一种简便方法
IUIComponent
 Inherited
确定是使用显式宽度还是测量宽度的一种简便方法
IUIComponent
 Inherited
getRect(targetCoordinateSpace:DisplayObject):Rectangle
返回一个矩形,该矩形根据 targetCoordinateSpace 参数定义的坐标系定义显示对象的边界,但不包括形状上的任何笔触。
IFlexDisplayObject
 Inherited
getStyle(styleProp:String):*
获取已在此组件的样式查找链中的某个位置设置过的样式属性。
IStyleClient
 Inherited
将 point 对象从舞台(全局)坐标转换为显示对象的(本地)坐标。
IFlexDisplayObject
 Inherited
检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。
IEventDispatcher
 Inherited
计算显示对象的边框,以确定它是否与 obj 显示对象的边框重叠或相交。
IFlexDisplayObject
 Inherited
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
计算显示对象,以确定它是否与 x 和 y 参数指定的点重叠或相交。
IFlexDisplayObject
 Inherited
初始化对象。
IUIComponent
 Inherited
调用此方法将导致在呈示显示列表前调用组件的 validateDisplayList() 方法。
IInvalidating
 Inherited
调用此方法将导致在呈示显示列表前调用组件的 validateProperties() 方法。
IInvalidating
 Inherited
调用此方法将导致在呈示显示列表前调用组件的 validateSize() 方法。
IInvalidating
 Inherited
将 point 对象从显示对象的(本地)坐标转换为舞台(全局)坐标。
IFlexDisplayObject
 Inherited
将此对象移动到指定的 x 和 y 坐标。
IFlexDisplayObject
 Inherited
向该组件的子项传送样式更改。
IStyleClient
 Inherited
owns(displayObject:DisplayObject):Boolean
如果 owner 属性链从 child 指向此 UIComponent,则返回 true。
IUIComponent
 Inherited
当在父项中添加或删除 UIComponent 对象时由 Flex 调用。
IUIComponent
 Inherited
设置内部样式缓存值,以便 getStyle() 方法可以起作用。
IStyleClient
 Inherited
将 EffectManager 注册为每个效果事件的事件侦听器之一。
IStyleClient
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
从 EventDispatcher 对象中删除侦听器。
IEventDispatcher
  
selectRange(anchorPosition:int, activePosition:int):void
选择由这些参数指定的范围内的文本。
ITextInput
 Inherited
setActualSize(newWidth:Number, newHeight:Number):void
设置此对象的实际大小。
IFlexDisplayObject
 Inherited
当组件获得焦点时,由 FocusManager 调用。
IFocusManagerComponent
 Inherited
setStyle(styleProp:String, newValue:*):void
对此组件实例设置样式属性。
IStyleClient
 Inherited
setVisible(value:Boolean, noEvent:Boolean = false):void
当 visible 属性发生更改时调用。
IUIComponent
  
确定 TextInput 的边框和背景是否可视。
ITextInput
 Inherited
当样式属性的值发生更改时调用。
ISimpleStyleClient
 Inherited
验证子项的位置和大小,并绘制其他可视内容。
ILayoutManagerClient
 Inherited
根据需要,通过立即调用 validateProperties()、validateSize() 和 validateDisplayList() 来验证并更新此对象的属性和布局。
IInvalidating
 Inherited
验证组件的属性。
ILayoutManagerClient
 Inherited
validateSize(recursive:Boolean = false):void
如果使用此 ILayoutManagerClient 调用 LayoutManager.invalidateSize() 方法,随后在测量时调用了 validateSize() 方法,则验证组件的度量大小。
ILayoutManagerClient
 Inherited
检查是否用此 EventDispatcher 对象或其任何祖代为指定事件类型注册了事件侦听器。
IEventDispatcher
属性详细信息

editable

属性
editable:Boolean

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

指示用户是否可以编辑此控件中的文本。如果值为 true,则表示用户可以编辑文本。

默认值为 true。



实现
    public function get editable():Boolean
    public function set editable(value:Boolean):void

horizontalScrollPosition

属性 
horizontalScrollPosition:Number

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

当前显示的最左端像素的内容区域中的像素位置。(内容区域包括控件的所有内容,不是仅包括当前显示的部分。)该属性始终设置为 0,并且如果将 wordWrap 设置为 true,将忽略更改。

默认值为 0。



实现
    public function get horizontalScrollPosition():Number
    public function set horizontalScrollPosition(value:Number):void

maxChars

属性 
maxChars:int

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

用户可以在文本字段中输入的最大字符数。此属性对通过设置控件的 texthtmlText 属性指定的文本的长度没有限制。

默认值为 0,这是一种特殊情况,表示字符数不受限制。



实现
    public function get maxChars():int
    public function set maxChars(value:int):void

mouseChildren

属性 
mouseChildren:Boolean

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

确定对象的子级是否支持鼠标或用户输入设备。如果对象支持鼠标或用户输入设备,用户可以通过使用鼠标或用户输入设备与之交互。默认值为 true

当您使用 Sprite 类的实例(而不是使用 SimpleButton 类)来创建按钮时,此属性很有用。当您使用 Sprite 实例来创建按钮时,可以选择使用 addChild() 方法添加其他 Sprite 实例来修饰该按钮。此过程可能导致鼠标事件出现意外行为,因为当您期望父实例成为鼠标事件的目标对象时,作为子项添加的 Sprite 实例却可能成为目标对象。要确保父实例用作鼠标事件的目标对象,您可以将父实例的 mouseChildren 属性设置为 false

设置此属性不会调度任何事件。您必须使用 addEventListener() 方法才能创建交互式功能。



实现
    public function get mouseChildren():Boolean
    public function set mouseChildren(value:Boolean):void

mouseEnabled

属性 
mouseEnabled:Boolean

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

指定此对象是否接收鼠标或其他用户输入、消息。默认值为 true,这表示默认情况下,显示列表上的任何 InteractiveObject 实例都会接收鼠标事件或其他用户输入事件。如果将 mouseEnabled 设置为 false,则实例将不接收任何鼠标事件(或其他用户输入事件,例如键盘事件)。显示列表上的该实例的任何子级都不会受到影响。要更改显示列表上对象的所有子级的 mouseEnabled 行为,请使用 flash.display.DisplayObjectContainer.mouseChildren

设置此属性不会调度任何事件。您必须使用 addEventListener() 方法才能创建交互式功能。



实现
    public function get mouseEnabled():Boolean
    public function set mouseEnabled(value:Boolean):void

parentDrawsFocus

属性 
parentDrawsFocus:Boolean

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

如果为 true,则对此控件的 drawFocus() 方法的调用会转到其父项的 drawFocus() 方法上。这用于当 TextInput 为复合控件(如 NumericStepper 或 ComboBox)的一部分时。

默认值为 false。



实现
    public function get parentDrawsFocus():Boolean
    public function set parentDrawsFocus(value:Boolean):void

restrict

属性 
restrict:String

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

指示用户可以输入到控件的字符集。如果 restrict 属性的值为 null,则可以输入任何字符。如果 restrict 属性的值为空字符串,则不能输入任何字符。此属性只限制用户交互;脚本可以将任何文本放入文本字段中。如果 restrict 属性的值为字符串,则只能在文本字段中输入该字符串中的字符。

Flex 按从左到右的顺序浏览字符串。可以使用连字符 (-) 指定一个范围。如果字符串以尖号 (^) 开头,则先接受所有字符,然后从接受字符集中排除字符串中 ^ 之后的字符。如果字符串不以尖号 (^) 开头,则最初不接受任何字符,然后将字符串中的字符包括在接受字符集中。

由于某些字符在 restrict 属性中使用时具有特殊的意义,因此必须使用反斜杠字符指定文本字符 -、^ 和 \。将 restrict 属性用作 MXML 标签中的属性时,请使用单一反斜杠,如下例所示:\^\-\\。当您在 ActionScript 表达式中设置 restrict 时,请使用两个反斜杠,如下例所示:\\^\\-\\\。

默认值为 null。



实现
    public function get restrict():String
    public function set restrict(value:String):void

相关 API 元素

selectable

属性 
selectable:Boolean

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

一个标志,指示是否可以选择 TextInput 中的文本。



实现
    public function get selectable():Boolean
    public function set selectable(value:Boolean):void

selectionActivePosition

属性 
selectionActivePosition:int  [只读]

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

当前所选内容中最后一个字符的位置从零开始的索引(与最后一个字符的从一开始的索引相等)。例如,如果所选内容中的最后一个字符是第五个字符,则此属性的值为 5。当控件获得焦点时,如果已经设置 selectionAnchorIndexselectionActiveIndex 这两种属性,则将能够看到选定内容。

默认值为 0。



实现
    public function get selectionActivePosition():int

selectionAnchorPosition

属性 
selectionAnchorPosition:int  [只读]

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

当前所选内容中第一个字符从零开始的字符索引值。例如,第一个字符的索引值是 0,第二个字符的索引值是 1,依此类推。当控件获得焦点时,如果已经设置 selectionAnchorIndexselectionActiveIndex 这两种属性,则将能够看到选定内容。

默认值为 0。



实现
    public function get selectionAnchorPosition():int

text

属性 
text:String

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

控件中出现的纯文本。其外观由此 Lable 控件的 CSS 样式确定。

文本字符串中的任何 HTML 标签都将被忽略,其显示效果就像以字符串形式输入的一样。要显示使用 HTML 标签进行格式设置的文本,请改用 htmlText 属性。如果设置了 htmlText 属性,则 HTML 将替换使用此属性设置的所有文本,并且 text 属性将返回 HTML 文本的纯文本版本,而从中去除了所有 HTML 标签。有关详细信息,请参阅 htmlText 属性。

要在文本中包括特殊字符左尖括号 (<)、右尖括号 (>) 或和号 (&),请将文本字符串包含在 CDATA 标签中。此外,您可以使用 HTML 字符实体表示特殊字符,例如 <

如果尝试将此属性设置为 null,则该属性将设置为空字符串。text 属性可暂时使用值 null,此值表示刚刚设置了 htmlText 值,但相应的 text 值尚未确定。

默认值为 ""。



实现
    public function get text():String
    public function set text(value:String):void
方法详细信息

selectRange

()方法
public function selectRange(anchorPosition:int, activePosition:int):void

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

选择由这些参数指定的范围内的文本。

参数

anchorPosition:int — 当前所选内容中第一个字符从零开始的字符索引值。
 
activePosition:int — 当前所选内容中最后一个字符后的位置从零开始的索引(与最后一个字符的从一开始的索引相等)。

showBorderAndBackground

()方法 
public function showBorderAndBackground(visible:Boolean):void

语言版本: ActionScript 3.0
产品版本: Flex 4
运行时版本: Flash Player 10, AIR 1.5

确定 TextInput 的边框和背景是否可视。

参数

visible:Boolean — 如果可见,则为 true,如果不可见,则为 false





[ X ]为什么显示为英语?
《ActionScript 3.0 参考》中的内容以英语显示

《ActionScript 3.0 参考》中的部分内容未翻译成所有语言。当某个语言元素未翻译时,将显示为英语。例如,ga.controls.HelpBox 类未翻译成任何语言。因此在简体中文版的参考中,ga.controls.HelpBox 类显示为英语。