mx.controls
public class Button
继承Button Inheritance UIComponent Inheritance FlexSprite Inheritance Sprite Inheritance DisplayObjectContainer Inheritance InteractiveObject Inheritance DisplayObject Inheritance EventDispatcher Inheritance Object
实现 IDataRenderer, IDropInListItemRenderer, IFocusManagerComponent, IListItemRenderer, IFontContextComponent, IButton
子类 AccordionHeader, CheckBox, LinkButton, PopUpButton, RadioButton, ScrollThumb, SliderThumb

Button 控件是常用的矩形按钮。Button 控件看起来似乎可以按压。控件表面可以包含文本标签和(或)图标。

当用户选择 Button 控件时,该控件通常使用事件侦听器来执行操作。当用户在 Button 控件上单击鼠标时,就会启用 Button 控件,此控件调度 click 事件和 buttonDown 事件。无论按钮是处于启用状态还是禁用状态,总是会调度 mouseMovemouseOvermouseOutrollOverrollOutmouseDownmouseUp 等事件。

您可以自定义 Button 控件的外观,并将其功能从按压按钮更改为切换按钮。您可以通过对按钮的各个状态使用同一外观来更改按钮外观。

Button 控件的标签使用粗体。若要嵌入某种字体,希望将其用于 Button 控件的标签,则必须嵌入粗体;例如:

<mx:style>
    @font-face {
      src:url("../MyFont-Bold.ttf");        
      fontFamily: myFont;
      fontWeight: bold;
    }
   .myBoldStyle {
      fontFamily: myFont;
      fontWeight: bold;
    } 
  </mx:style>
  ...
  <mx:Button ... styleName="myBoldStyle"/>

Button 控件具有下列默认特征:

特征说明
默认大小此大小足以包含标签文本及任何图标
最小大小0 个像素
最大大小无限制

MXML 语法expanded隐藏 MXML 语法

The <mx:Button> tag inherits all the tag attributes of its superclass, and adds the following tag attributes:

  <mx:Button
    Properties
    autoRepeat="false|true"
    emphasized="false|true"
    fontContext="IFontModuleFactory"
    label=""
    labelPlacement="right|left|bottom|top"
    selected="false|true"
    selectedField="null"
    stickyHighlighting="false|true"
    toggle="false|true"
 
    Styles
    borderColor="0xAAB3B3"
    color="0x0B333C"
    cornerRadius="4"
    disabledColor="0xAAB3B3"
    disabledIcon="null"
    disabledSkin="mx.skins.halo.ButtonSkin"
    downIcon="null"
    downSkin="mx.skins.halo.ButtonSkin"
    fillAlphas="[0.6, 0.4]"
    fillColors="[0xE6EEEE, 0xFFFFFF]"
    focusAlpha="0.5"
    focusRoundedCorners"tl tr bl br"
    fontAntiAliasType="advanced"
    fontFamily="Verdana"
    fontGridFitType="pixel"
    fontSharpness="0"
    fontSize="10"
    fontStyle="normal|italic"
    fontThickness="0"
    fontWeight="bold|normal"
    highlightAlphas="[0.3, 0.0]"
    horizontalGap="2"
    icon="null"
    kerning="false|true"
    leading="2"
    letterSpacing="0"
    overIcon="null"
    overSkin="mx.skins.halo.ButtonSkin"
    paddingBottom="0"
    paddingLeft="0"
    paddingRight="0"
    paddingTop="0"
    repeatDelay="500"
    repeatInterval="35"
    selectedDisabledIcon="null"
    selectedDisabledSkin="mx.skins.halo.ButtonSkin"
    selectedDownIcon="null"
    selectedDownSkin="mx.skins.halo.ButtonSkin"
    selectedOverIcon="null"
    selectedOverSkin="mx.skins.halo.ButtonSkin"
    selectedUpIcon="null"
    selectedUpSkin="mx.skins.halo.ButtonSkin"
    skin="mx.skins.halo.ButtonSkin"
    textAlign="center|left|right"
    textDecoration="none|underline"
    textIndent="0"
    textRollOverColor="0x2B333C"
    textSelectedColor="0x000000"
    upIcon="null"
    upSkin="mx.skins.halo.ButtonSkin"
    verticalGap="2"
 
    Events
    buttonDown="No default"
    change="No default"
    dataChange="No default"
  />
  

查看示例

另请参见

Button control
Creating custom components


公共属性
 属性定义方
 InheritedaccessibilityProperties : AccessibilityProperties
此显示对象的当前辅助功能选项。
DisplayObject
 InheritedactiveEffects : Array
[只读 (read-only)] 组件上当前播放的效果列表,如 EffectInstance 实例的 Array。
UIComponent
 Inheritedalpha : Number
指示指定对象的 Alpha 透明度值。
DisplayObject
 InheritedautomationDelegate : Object
处理自动化相关功能的委托对象。
UIComponent
 InheritedautomationName : String
可用作此对象的标识符的名称。
UIComponent
 InheritedautomationTabularData : Object
[只读 (read-only)] IAutomationTabularData 接口的实现,可用于检索数据。
UIComponent
 InheritedautomationValue : Array
[只读 (read-only)] 此值通常对应于对象的经渲染的外观,当对象在应用中以可视方式显示时,此值使标识符与该对象相关联。
UIComponent
  autoRepeat : Boolean
指定在用户按住鼠标按键时是否重复调度 buttonDown 事件。
Button
 InheritedbaselinePosition : Number
[只读 (read-only)] 组件第一行文本的基线的 y 坐标。
UIComponent
 InheritedblendMode : String
BlendMode 类中的一个值,用于指定要使用的混合模式。
DisplayObject
 InheritedblendShader : Shader
[只写] 设置用于混合前景和背景的着色器。
DisplayObject
 InheritedbuttonMode : Boolean
指定此 sprite 的按钮模式。
Sprite
 InheritedcacheAsBitmap : Boolean
如果设置为 true,则 Flash Player 或 Adobe AIR 将缓存显示对象的内部位图表示形式。
DisplayObject
 InheritedcacheHeuristic : Boolean
[只写] 供 Flex 使用,表示建议为对象实施位图缓存。
UIComponent
 InheritedcachePolicy : String
指定此对象的位图缓存策略。
UIComponent
 InheritedclassName : String
[只读 (read-only)] 此实例的类的名称,如“Button”。
UIComponent
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
 InheritedcontentMouseX : Number
[只读 (read-only)] 返回鼠标在内容坐标系中的 x 位置。
UIComponent
 InheritedcontentMouseY : Number
[只读 (read-only)] 返回内容坐标系中鼠标的 y 位置。
UIComponent
 InheritedcontextMenu : NativeMenu
指定与此对象相关联的上下文菜单。
InteractiveObject
 InheritedcurrentState : String
组件的当前视图状态。
UIComponent
 InheritedcursorManager : ICursorManager
[只读 (read-only)] 获取控制此组件及其同级组件的光标的 CursorManager。
UIComponent
  data : Object
当您将某个组件用作项目渲染器或项目编辑器时,可借助 data 属性向该组件传递值。
Button
 Inheriteddescriptor : UIComponentDescriptor
引用 UIComponentDescriptor(如果有),过去曾通过 createComponentFromDescriptor() 方法使用它来创建此 UIComponent 实例。
UIComponent
 Inheriteddocument : Object
引用与此 UIComponent 相关联的文档对象。
UIComponent
 InheriteddoubleClickEnabled : Boolean
指定 UIComponent 对象是否接收 doubleClick 事件。
UIComponent
 InheriteddropTarget : DisplayObject
[只读 (read-only)] 指定拖动 sprite 时经过的显示对象,或放置 sprite 的显示对象。
Sprite
  emphasized : Boolean
当 Button 控件处于弹起状态并且 emphasized 设置为 true 时,在该控件周围绘制宽边框。
Button
 Inheritedenabled : Boolean
组件是否可以接受用户交互。
UIComponent
 InheritederrorString : String
当验证程序监视组件并且验证失败时,组件的错误提示中将显示的文本。
UIComponent
 InheritedexplicitHeight : Number
指定该组件在组件坐标中显式高度(以像素为单位)的数字。
UIComponent
 InheritedexplicitMaxHeight : Number
布局过程中父级要考虑的组件最大建议高度。
UIComponent
 InheritedexplicitMaxWidth : Number
布局过程中父级要考虑的组件最大建议宽度。
UIComponent
 InheritedexplicitMinHeight : Number
布局过程中父级要考虑的组件最小建议高度。
UIComponent
 InheritedexplicitMinWidth : Number
布局过程中父级要考虑的组件最小建议宽度。
UIComponent
 InheritedexplicitWidth : Number
指定该组件在组件坐标中显式宽度(以像素为单位)的数字。
UIComponent
 Inheritedfilters : Array
包含当前与显示对象关联的每个滤镜对象的索引数组。
DisplayObject
 InheritedflexContextMenu : IFlexContextMenu
此 UIComponent 的上下文菜单。
UIComponent
 InheritedfocusEnabled : Boolean
指示切换到此组件时,是否可以接收焦点。
UIComponent
 InheritedfocusManager : IFocusManager
获取控制此组件及其同级组件的焦点的 FocusManager。
UIComponent
 InheritedfocusPane : Sprite
与此对象相关联的焦点窗格。
UIComponent
 InheritedfocusRect : Object
指定此对象是否显示焦点矩形。
InteractiveObject
  fontContext : IFlexModuleFactory
为此组件提供字体上下文的模块工厂。
Button
 Inheritedgraphics : Graphics
[只读 (read-only)] 指定属于此 sprite 的 Graphics 对象,在此 sprite 中可执行矢量绘画命令。
Sprite
 Inheritedheight : Number
指定组件在父坐标中的高度的数字(以像素为单位)。
UIComponent
 InheritedhitArea : Sprite
指定一个 sprite 用作另一个 sprite 的点击区域。
Sprite
 Inheritedid : String
组件 ID。
UIComponent
 InheritedincludeInLayout : Boolean
指定此组件是否包含在父容器的布局中。
UIComponent
 InheritedinheritingStyles : Object
此组件的继承样式链的开头内容。
UIComponent
 Inheritedinitialized : Boolean
一个标志,用于确定某个对象是否已通过布局的所有三个阶段:提交、测量和布局(假设每个阶段都是必需的)。
UIComponent
 InheritedinstanceIndex : int
[只读 (read-only)] 重复组件的索引。
UIComponent
 InheritedinstanceIndices : Array
一个 Array,包含从此 UIComponent 对象的父文档引用该对象所需的索引。
UIComponent
 InheritedisDocument : Boolean
[只读 (read-only)] 确定此 UIComponent 实例是否为文档对象,也就是说它是否位于 Flex 应用程序、MXML 组件或 ActionScript 组件层次结构的顶层。
UIComponent
 InheritedisPopUp : Boolean
PopUpManager 将其设置为 true 以指示已弹出该组件。
UIComponent
  label : String
要在 Button 控件上显示的文本。
Button
  labelPlacement : String
标签相对于指定图标的方向。
Button
  listData : BaseListData
使用组件作为嵌入式项目渲染器或嵌入式项目编辑器时,Flex 将使用 list 控件中的相应数据初始化该组件的 listData 属性。
Button
 InheritedloaderInfo : LoaderInfo
[只读 (read-only)] 返回一个 LoaderInfo 对象,其中包含加载此显示对象所属的文件的相关信息。
DisplayObject
 Inheritedmask : DisplayObject
调用显示对象被指定的 mask 对象遮罩。
DisplayObject
 InheritedmaxHeight : Number
布局过程中父级要考虑的组件最大建议高度。
UIComponent
 InheritedmaxWidth : Number
布局过程中父级要考虑的组件最大建议宽度。
UIComponent
 InheritedmeasuredHeight : Number
组件的默认高度(以像素为单位)。
UIComponent
 InheritedmeasuredMinHeight : Number
组件的默认最小高度(以像素为单位)。
UIComponent
 InheritedmeasuredMinWidth : Number
组件的默认最小宽度(以像素为单位)。
UIComponent
 InheritedmeasuredWidth : Number
组件的默认宽度(以像素为单位)。
UIComponent
 InheritedminHeight : Number
布局过程中父级要考虑的组件最小建议高度。
UIComponent
 InheritedminWidth : Number
布局过程中父级要考虑的组件最小建议宽度。
UIComponent
 InheritedmoduleFactory : IFlexModuleFactory
用于在正确的 SWF 上下文中创建 TextFields 的 moduleFactory。
UIComponent
 InheritedmouseChildren : Boolean
确定对象的子项是否支持鼠标。
DisplayObjectContainer
 InheritedmouseEnabled : Boolean
指定此对象是否接收鼠标消息。
InteractiveObject
 InheritedmouseFocusEnabled : Boolean
单击时是否可接收焦点。
UIComponent
 InheritedmouseX : Number
[只读 (read-only)] 指示鼠标位置的 x 坐标,以像素为单位。
DisplayObject
 InheritedmouseY : Number
[只读 (read-only)] 指示鼠标位置的 y 坐标,以像素为单位。
DisplayObject
 Inheritedname : String
指示 DisplayObject 的实例名称。
DisplayObject
 InheritednestLevel : int
此对象在所属关系层次结构中的深度。
UIComponent
 InheritednonInheritingStyles : Object
此组件的非继承样式链的开头内容。
UIComponent
 InheritednumAutomationChildren : int
[只读 (read-only)] 此容器包含的自动化子项数。
UIComponent
 InheritednumChildren : int
[只读 (read-only)] 返回此对象的子项数目。
DisplayObjectContainer
 InheritedopaqueBackground : Object
指定显示对象是否由于具有某种背景颜色而不透明。
DisplayObject
 Inheritedowner : DisplayObjectContainer
此 UIComponent 的所有者。
UIComponent
 Inheritedparent : DisplayObjectContainer
[只读 (read-only)] 此组件的父容器或组件。
UIComponent
 InheritedparentApplication : Object
[只读 (read-only)] 引用包含此 UIComponent 实例的 Application 对象。
UIComponent
 InheritedparentDocument : Object
[只读 (read-only)] 引用此 UIComponent 的父文档对象。
UIComponent
 InheritedpercentHeight : Number
以组件父项大小百分比的方式指定组件高度的数字。
UIComponent
 InheritedpercentWidth : Number
以组件父项大小百分比形式指定其宽度的数字。
UIComponent
 InheritedprocessedDescriptors : Boolean
临时或延迟子项创建操作后设置为 true,具体取决于发生对象。
UIComponent
 Inheritedprototype : Object
[静态] 对类或函数对象的原型对象的引用。
Object
 Inheritedrepeater : IRepeater
[只读 (read-only)] 对生成此 UIComponent 的父文档中 Repeater 对象的引用。
UIComponent
 InheritedrepeaterIndex : int
[只读 (read-only)] 项目在生成此 UIComponent 的 Repeater 数据提供程序中的索引。
UIComponent
 InheritedrepeaterIndices : Array
一个 Array,包含项目在生成此 UIComponent 的父文档的 Repeater 数据提供程序中的索引。
UIComponent
 Inheritedrepeaters : Array
一个 Array,包含对生成此 UIComponent 的父文档中 Repeater 对象的引用。
UIComponent
 Inheritedroot : DisplayObject
[只读 (read-only)] 对于加载的 SWF 文件中的显示对象,root 属性是此 SWF 文件所表示的显示列表树结构部分中的顶级显示对象。
DisplayObject
 Inheritedrotation : Number
指示 DisplayObject 实例距其原始方向的旋转程度,以度为单位。
DisplayObject
 InheritedrotationX : Number
指示 DisplayObject 实例相对于 3D 父容器距离其原始方向的 x 轴旋转(以度为单位)。
DisplayObject
 InheritedrotationY : Number
指示 DisplayObject 实例相对于 3D 父容器距离其原始方向的 y 轴旋转(以度为单位)。
DisplayObject
 InheritedrotationZ : Number
指示 DisplayObject 实例相对于 3D 父容器距离其原始方向的 z 轴旋转(以度为单位)。
DisplayObject
 Inheritedscale9Grid : Rectangle
当前有效的缩放网格。
DisplayObject
 InheritedscaleX : Number
用于指定水平缩放系数的数字。
UIComponent
 InheritedscaleY : Number
用于指定垂直缩放系数的数字。
UIComponent
 InheritedscaleZ : Number
指示从对象的注册点开始应用的对象的深度缩放比例(百分比)。
DisplayObject
 Inheritedscreen : Rectangle
[只读 (read-only)] 返回包含此对象的基本绘图表面大小和位置的对象。
UIComponent
 InheritedscrollRect : Rectangle
显示对象的滚动矩形范围。
DisplayObject
  selected : Boolean
指示切换按钮是处于启用状态 (true) 还是禁用状态 (false)。
Button
  selectedField : String = "null"
data 属性中用于为 Button 控件的 selected 属性指定值的字段的名称。
Button
 InheritedshowInAutomationHierarchy : Boolean
用于确定自动化对象是否显示在自动化层次中的标志。
UIComponent
 InheritedsoundTransform : SoundTransform
控制此 sprite 中的声音。
Sprite
 Inheritedstage : Stage
[只读 (read-only)] 显示对象的舞台。
DisplayObject
 Inheritedstates : Array
为此组件定义的视图状态。
UIComponent
  stickyHighlighting : Boolean = false
如果为 false,则 Button 会在用户按下它时显示其按下时的外观,但在用户将鼠标拖离它时将改为显示整体外观。
Button
 InheritedstyleDeclaration : CSSStyleDeclaration
存储此对象的内嵌继承样式。
UIComponent
 InheritedstyleName : Object
此组件使用的类样式。
UIComponent
 InheritedsystemManager : ISystemManager
返回此组件使用的 SystemManager 对象。
UIComponent
 InheritedtabChildren : Boolean
确定对象的子项是否支持 Tab 键。
DisplayObjectContainer
 InheritedtabEnabled : Boolean
指定此对象是否遵循 Tab 键顺序。
InteractiveObject
 InheritedtabIndex : int
指定 SWF 文件中的对象按 Tab 键顺序排列。
InteractiveObject
 InheritedtextSnapshot : TextSnapshot
[只读 (read-only)] 返回此 DisplayObjectContainer 实例的 TextSnapshot 对象。
DisplayObjectContainer
  toggle : Boolean
控制 Button 是否处于切换状态。
Button
 InheritedtoolTip : String
要在 ToolTip 中显示的文本。
UIComponent
 Inheritedtransform : Transform
一个对象,具有与显示对象的矩阵、颜色转换和像素范围有关的属性。
DisplayObject
 Inheritedtransitions : Array
一个 Transition 对象 Array,其中的每个 Transition 对象都定义一组效果,用于在视图状态发生更改时播放。
UIComponent
 InheritedtweeningProperties : Array
当前在此对象上进行补间的属性数组。
UIComponent
 Inheriteduid : String
对象的唯一标识符。
UIComponent
 InheritedupdateCompletePendingFlag : Boolean
一个标志,确定某个对象是否已通过所有三个阶段的布局验证(假设需要通过所有验证)。
UIComponent
 InheriteduseHandCursor : Boolean
布尔值,指示当鼠标滑过其 buttonMode 属性设置为 true 的 sprite 时是否显示手指形(手形光标)。
Sprite
 InheritedvalidationSubField : String
供验证程序用来将子字段与此组件相关联。
UIComponent
 Inheritedvisible : Boolean
控制此 UIComponent 的可见性。
UIComponent
 Inheritedwidth : Number
指定组件在父坐标中的宽度的数字(以像素为单位)。
UIComponent
 Inheritedx : Number
指定组件在其父容器中的水平位置(以像素为单位)的数字。
UIComponent
 Inheritedy : Number
指定组件在其父容器中的垂直位置(以像素为单位)的数字。
UIComponent
 Inheritedz : Number
指示 DisplayObject 实例相对于 3D 父容器沿 z 轴的 z 坐标位置。
DisplayObject
受保护的属性
 属性定义方
 InheritedresourceManager : IResourceManager
[只读 (read-only)] 引用管理所有应用程序本地化资源的对象。
UIComponent
  textField : IUITextField
呈现此 Button 的标签的内部 UITextField 对象。
Button
 InheritedunscaledHeight : Number
[只读 (read-only)] 用于确定组件的未缩放高度的简便方法。
UIComponent
 InheritedunscaledWidth : Number
[只读 (read-only)] 用于确定组件的未缩放宽度的简便方法。组件的绘图和子布局的所有设置均应在以此宽度为宽的矩形边框中完成,还应将此宽度作为参数传递到 updateDisplayList() 中。
UIComponent
公共方法
 方法定义方
  
构造函数。
Button
 Inherited
将一个 DisplayObject 子实例添加到该 DisplayObjectContainer 实例中。
DisplayObjectContainer
 Inherited
将一个 DisplayObject 子实例添加到该 DisplayObjectContainer 实例中。
DisplayObjectContainer
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。
EventDispatcher
 Inherited
指示安全限制是否会导致出现以下情况:在列表中忽略了使用指定 point 点调用 DisplayObjectContainer.getObjectsUnderPoint() 方法时返回的所有显示对象。
DisplayObjectContainer
 Inherited
callLater(method:Function, args:Array = null):void
排队稍后调用的函数。
UIComponent
 Inherited
删除此组件实例中的样式属性。
UIComponent
 Inherited
确定指定显示对象是 DisplayObjectContainer 实例的子项还是该实例本身。
DisplayObjectContainer
 Inherited
将 Point 对象由内容坐标转换为全局坐标。
UIComponent
 Inherited
将 Point 对象由内容坐标转换为本地坐标。
UIComponent
 Inherited
返回标识此容器中的子项的一组属性。
UIComponent
 Inherited
在 IUIComponent 对象的父项文档对象上创建对此对象的 id 引用。
UIComponent
 Inherited
在 IUIComponent 对象的父项文档对象上删除对此对象的 id 引用。
UIComponent
 Inherited
返回与此 UIComponent 的文本样式对应的 UITextFormat 对象。
UIComponent
 Inherited
将事件调度到事件流中。
UIComponent
 Inherited
在此组件周围显示或隐藏焦点指示符。
UIComponent
 Inherited
drawRoundRect(x:Number, y:Number, width:Number, height:Number, cornerRadius:Object = null, color:Object = null, alpha:Object = null, gradientMatrix:Matrix = null, gradientType:String = "linear", gradientRatios:Array = null, hole:Object = null):void
通过编程方式在此外观的 Graphics 对象中绘制一个矩形。
UIComponent
 Inherited
停止在组件上播放效果实例时,由效果实例调用。
UIComponent
 Inherited
开始在组件上播放效果实例时,由效果实例调用。
UIComponent
 Inherited
结束组件上当前播放的所有效果。
UIComponent
 Inherited
executeBindings(recurse:Boolean = false):void
将数据绑定到此 UIComponent 对象。
UIComponent
 Inherited
打印完成后调用。
UIComponent
 Inherited
在指定的索引位置提供自动化对象。
UIComponent
 Inherited
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
返回一个矩形,该矩形定义相对于 targetCoordinateSpace 对象坐标系的显示对象区域。
DisplayObject
 Inherited
返回位于指定索引处的子显示对象实例。
DisplayObjectContainer
 Inherited
返回具有指定名称的子显示对象。
DisplayObjectContainer
 Inherited
返回 DisplayObject 的 child 实例的索引位置。
DisplayObjectContainer
 Inherited
查找此 UIComponent 实例的类型选择器。
UIComponent
 Inherited
getConstraintValue(constraintName:String):*
返回一个约束布局值,这与获取此组件的约束样式的方式类似。
UIComponent
 Inherited
确定是使用显式高度还是测量高度的一种简便方法
UIComponent
 Inherited
确定是使用显式宽度还是测量宽度的一种简便方法
UIComponent
 Inherited
获取当前具有焦点的对象。
UIComponent
 Inherited
返回对象的数组,这些对象位于指定点下,并且是该 DisplayObjectContainer 实例的子项(或孙子项,依此类推)。
DisplayObjectContainer
 Inherited
getRect(targetCoordinateSpace:DisplayObject):Rectangle
返回一个矩形,该矩形根据 targetCoordinateSpace 参数定义的坐标系定义显示对象的边界,但不包括形状上的任何笔触。
DisplayObject
 Inherited
getRepeaterItem(whichRepeater:int = -1):Object
返回 dataProvider 中由指定的 Repeater 用来生成此 Repeater 的项目;如果此 Repeater 未重复,则返回 null。
UIComponent
 Inherited
getStyle(styleProp:String):*
获取已在此组件的样式查找链中的某个位置设置过的样式属性。
UIComponent
 Inherited
将 Point 对象由全局坐标转换为内容坐标。
UIComponent
 Inherited
将 point 对象从舞台(全局)坐标转换为显示对象的(本地)坐标。
DisplayObject
 Inherited
将二维点从舞台(全局)坐标转换为三维显示对象的(本地)坐标。
DisplayObject
 Inherited
检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。
EventDispatcher
 Inherited
指示对象是否已经定义了指定的属性。
Object
 Inherited
计算显示对象,以确定它是否与 obj 显示对象重叠或相交。
DisplayObject
 Inherited
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
计算显示对象,以确定它是否与 x 和 y 参数指定的点重叠或相交。
DisplayObject
 Inherited
返回一个框 Matrix,在绘制水平渐变时可以将其作为 rot 参数传递给 drawRoundRect() 方法。
UIComponent
 Inherited
初始化此组件的内部结构。
UIComponent
 Inherited
初始化用于跟踪此组件的重复实例的各个属性。
UIComponent
 Inherited
标记组件,以便在稍后屏幕更新期间调用该组件的 updateDisplayList() 方法。
UIComponent
 Inherited
标记组件,以便在稍后屏幕更新期间调用该组件的 commitProperties() 方法。
UIComponent
 Inherited
标记组件,以便在稍后屏幕更新期间调用该组件的 measure() 方法。
UIComponent
 Inherited
指示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
 Inherited
将三维显示对象的(本地)坐标的三维点转换为舞台(全局)坐标中的二维点。
DisplayObject
 Inherited
将 Point 对象由本地坐标转换为内容坐标。
UIComponent
 Inherited
将 point 对象从显示对象的(本地)坐标转换为舞台(全局)坐标。
DisplayObject
 Inherited
测量指定的 HTML 文本(该文本中可能包含 <font> 和 <b> 等 HTML 标记),假定该文本显示在单行 UITextField(使用由此 UIComponent 的样式确定的 UITextFormat)中。
UIComponent
 Inherited
测量指定的文本,假定该文本显示在单行 UITextField(使用由此 UIComponent 的样式确定的 UITextFormat)中。
UIComponent
 Inherited
将组件移动到其父项内的指定位置。
UIComponent
 Inherited
将样式更改传播到子项。
UIComponent
 Inherited
如果 owner 属性链从 child 指向此 UIComponent,则返回 true。
UIComponent
 Inherited
当在父项中添加或删除 UIComponent 对象时由 Flex 调用。
UIComponent
 Inherited
准备 IFlexDisplayObject 用于打印。
UIComponent
 Inherited
指示指定的属性是否存在、是否可枚举。
Object
 Inherited
为此组件构建或重新构建 CSS 样式缓存;如果 recursive 参数为 true,还会为此组件的所有后代执行同样的操作。
UIComponent
 Inherited
针对每个效果事件,将 EffectManager 注册为一个事件侦听器。
UIComponent
 Inherited
从 DisplayObjectContainer 实例的子列表中删除指定的 child DisplayObject 实例。
DisplayObjectContainer
 Inherited
从 DisplayObjectContainer 的子列表中指定的 index 位置删除子 DisplayObject。
DisplayObjectContainer
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
从 EventDispatcher 对象中删除侦听器。
EventDispatcher
 Inherited
重放指定的事件。
UIComponent
 Inherited
使用提供的 ID 解析子项。
UIComponent
 Inherited
[静态] 在调用 suspendBackgroundProcessing() 之后继续对使用 callLater() 排队的方法进行背景处理。
UIComponent
 Inherited
调整对象大小。
UIComponent
 Inherited
更改现有子项在显示对象容器中的位置。
DisplayObjectContainer
 Inherited
setConstraintValue(constraintName:String, value:*):void
设置一个布局约束值的方式,与设置此组件的约束样式的方式相同。
UIComponent
 Inherited
setCurrentState(stateName:String, playTransition:Boolean = true):void
设置当前状态。
UIComponent
 Inherited
设置此组件的焦点。
UIComponent
 Inherited
设置循环操作动态属性的可用性。
Object
 Inherited
setStyle(styleProp:String, newValue:*):void
对此组件实例设置样式属性。
UIComponent
 Inherited
setVisible(value:Boolean, noEvent:Boolean = false):void
当 visible 属性发生更改时调用。
UIComponent
 Inherited
startDrag(lockCenter:Boolean = false, bounds:Rectangle = null):void
允许用户拖动指定的 Sprite。
Sprite
 Inherited
结束 startDrag() 方法。
Sprite
 Inherited
检测对样式属性的更改。
UIComponent
 Inherited
首次初始化组件样式时,Flex 会调用 stylesInitialized() 方法。
UIComponent
 Inherited
[静态] 阻止对使用 callLater() 排队的方法进行背景处理,直到调用 resumeBackgroundProcessing() 为止。
UIComponent
 Inherited
交换两个指定子对象的 Z 轴顺序(从前到后顺序)。
DisplayObjectContainer
 Inherited
swapChildrenAt(index1:int, index2:int):void
在子级列表中两个指定的索引位置,交换子对象的 Z 轴顺序(前后顺序)。
DisplayObjectContainer
 Inherited
返回一个字符串,用于指示此对象在应用程序的 DisplayObject 层次结构中所处的位置。
FlexSprite
 Inherited
验证子项的位置和大小,并绘制其它可视内容。
UIComponent
 Inherited
验证并更新此对象的属性和布局,如果需要的话重绘对象。
UIComponent
 Inherited
由布局逻辑用于通过调用 commitProperties() 方法来验证组件的属性。
UIComponent
 Inherited
validateSize(recursive:Boolean = false):void
如果使用此 ILayoutManagerClient 调用 LayoutManager.invalidateSize() 方法,随后在测量时调用了 validateSize() 方法,则验证组件的度量大小。
UIComponent
 Inherited
处理分配给此组件的验证程序调度的 valid 和 invalid 事件。
UIComponent
 Inherited
返回指定对象的原始值。
Object
 Inherited
返回一个框 Matrix,在绘制垂直渐变时可以将其作为 rot 参数传递给 drawRoundRect()。
UIComponent
 Inherited
检查是否用此 EventDispatcher 对象或其任何始祖为指定事件类型注册了事件侦听器。
EventDispatcher
受保护的方法
 方法定义方
 Inherited
调整焦点矩形。
UIComponent
 Inherited
这是一个内部方法,供 Flex 框架用于支持 Dissolve 效果。
UIComponent
 Inherited
创建子对象后执行任何最终处理。
UIComponent
  
MouseEvent.CLICK 事件的默认处理函数。
Button
 Inherited
处理对组件设置的属性。
UIComponent
 Inherited
‏‏创建组件的子对象。
UIComponent
 Inherited
根据所用的嵌入字体使用上下文创建新对象。
UIComponent
 Inherited
使用给定的 moduleFactory 创建对象。
UIComponent
 Inherited
当 UIComponent 对象获得焦点时调用的事件处理函数。
UIComponent
 Inherited
当 UIComponent 对象失去焦点时调用的事件处理函数。
UIComponent
 Inherited
完成对此组件的初始化。
UIComponent
 Inherited
初始化此组件的辅助功能代码。
UIComponent
 Inherited
通常由包含 UITextField 对象的组件覆盖,其中 UITextField 对象获取焦点。
UIComponent
 Inherited
为 keyDown 事件调用的事件处理函数。
UIComponent
 Inherited
为 keyUp 事件调用的事件处理函数。
UIComponent
 Inherited
计算组件的默认大小和(可选)默认最小大小。
UIComponent
  
MouseEvent.MOUSE_DOWN 事件的默认处理函数。
Button
  
MouseEvent.MOUSE_UP 事件的默认处理函数。
Button
 Inherited
构建 UIComponent 时将调用此方法,并且每当 ResourceManager 调度“change”事件用于指示本地化资源已经过某种更改时,都会再次调用此方法。
UIComponent
  
MouseEvent.ROLL_OUT 事件的默认处理函数。
Button
  
MouseEvent.ROLL_OVER 事件的默认处理函数。
Button
 Inherited
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
绘制对象和/或设置其子项的大小和位置。
UIComponent
事件
 事件 摘要 定义方
 Inherited[广播事件] Flash Player 或 AIR 应用程序获得操作系统焦点并变为活动状态时将调度此事件。EventDispatcher
 Inherited使用 addChild() 或 addChildAt() 方法将组件作为内容子项添加到容器时调度。UIComponent
 Inherited将显示对象添加到显示列表中时调度。DisplayObject
 Inherited在将显示对象直接添加到舞台显示列表或将包含显示对象的子树添加至舞台显示列表中时调度。DisplayObject
  当用户按压 Button 控件时调度。Button
  当切换 Button 控件的 selected 属性发生更改时调度。Button
 Inherited当用户从文本上下文菜单中选择“清除”(或“删除”)时调度。InteractiveObject
 Inherited用户在同一 InteractiveObject 上按下并释放用户指针设备的主按钮时调度。InteractiveObject
 Inherited当用户在 AIR 应用程序中选择与此交互式对象相关联的上下文菜单时调度。InteractiveObject
 Inherited当用户激活特定于平台的复制操作的快捷键组合或从文本上下文菜单中选择“复制”时调度。InteractiveObject
 Inherited当组件完成其构建、属性处理、测量、布置和绘制时调度。UIComponent
 Inherited视图状态更改后调度。UIComponent
 Inherited在 currentState 属性更改后但视图状态更改前调度。UIComponent
 Inherited当用户激活特定于平台的剪切操作的快捷键组合或从文本上下文菜单中选择“剪切”时调度。InteractiveObject
  当 data 属性更改时进行调度。Button
 Inherited[广播事件] Flash Player 或 AIR 应用程序失去操作系统焦点并变为非活动状态时将调度此事件。EventDispatcher
 Inherited如果 InteractiveObject 的 doubleClickEnabled 标志设置为 true,当用户在该对象上快速连续按下两次并释放指针设备的主按钮时调度。InteractiveObject
 Inherited在拖动操作完成时(将拖动的数据放到放置目标时或在没有执行放置操作的情况下结束拖放操作时)由拖动启动器(作为要拖动的数据源的组件)调度。UIComponent
 Inherited用户在放置目标上释放鼠标时由放置目标调度。UIComponent
 Inherited当用户在拖动操作过程中将鼠标移动到某个组件所处的位置时,由该组件调度。UIComponent
 Inherited用户在组件外拖动但没有将数据放置到目标时,由组件调度。UIComponent
 Inherited在拖动操作期间,当用户在鼠标位于组件上方的情况下移动鼠标时,由组件调度。UIComponent
 Inherited启动拖动操作时,由拖动启动器调度。UIComponent
 Inherited在一个效果结束后调度。UIComponent
 Inherited在即将开始播放效果前调度。UIComponent
 Inherited[播放事件] 播放头进入新帧时调度。DisplayObject
 Inherited组件返回到根视图状态之后调度。UIComponent
 Inherited[广播事件] 播放头退出当前帧时调度。DisplayObject
 Inherited组件退出根视图状态之前调度。UIComponent
 Inherited显示对象获得焦点后调度。InteractiveObject
 Inherited显示对象失去焦点后调度。InteractiveObject
 Inherited[广播事件] 在帧显示对象的构造函数运行之后但在帧脚本运行之前调度。DisplayObject
 Inherited当对象的状态从可见变为不可见时调度。UIComponent
 Inherited当组件完成构建并设置了所有初始化属性后调度。UIComponent
 Inherited当组件由 Validator 监控且未通过验证时调度。UIComponent
 Inherited用户按下某个键时调度。InteractiveObject
 Inherited用户尝试使用键盘导航更改焦点时调度。InteractiveObject
 Inherited用户释放某个键时调度。InteractiveObject
 Inherited当用户在同一 InteractiveObject 上按下并释放用户指针设备的中间按钮时调度。InteractiveObject
 Inherited当用户在 InteractiveObject 实例上按下指针设备的中间按钮时调度。InteractiveObject
 Inherited当用户在 InteractiveObject 实例上释放指针设备按钮时调度。InteractiveObject
 Inherited当用户在 InteractiveObject 实例上按下指针设备按钮时调度。InteractiveObject
 Inherited当用户在使用 PopUpManager 打开的某个组件外部单击时,从该组件调度。UIComponent
 Inherited用户尝试使用指针设备更改焦点时调度。InteractiveObject
 Inherited用户移动 InteractiveObject 上的指针设备时调度。InteractiveObject
 Inherited用户将指针设备从 InteractiveObject 实例上移开时调度。InteractiveObject
 Inherited用户将指针设备移动到 InteractiveObject 实例上时调度。InteractiveObject
 Inherited当用户在 InteractiveObject 实例上释放指针设备按钮时调度。InteractiveObject
 Inherited当鼠标滚轮滚动到 InteractiveObject 实例上时调度。InteractiveObject
 Inherited当用户使用鼠标滚轮滚动到使用 PopUpManager 打开的某个组件外部时,从该组件调度。UIComponent
 Inherited移动对象后调度。UIComponent
 Inherited当用户释放拖动动作时由拖动启动器 InteractiveObject 调度。InteractiveObject
 Inherited在将拖动对象放置到目标上且已通过对 DragManager.acceptDragDrop() 的调用接受该放置操作时,由目标 InteractiveObject 调度。InteractiveObject
 Inherited当拖动动作进入其边界时由 InteractiveObject 调度。InteractiveObject
 Inherited当拖动动作离开其边界时由 InteractiveObject 调度。InteractiveObject
 Inherited当拖动动作保持在其边界内时,由 InteractiveObject 持续调度。InteractiveObject
 Inherited在拖动操作开始时由在 DragManager.doDrag() 调用中指定为拖动启动器的 InteractiveObject 调度。InteractiveObject
 Inherited在拖动操作期间由在 DragManager.doDrag() 调用中指定为拖动启动器的 InteractiveObject 调度。InteractiveObject
 Inherited当用户激活特定于平台的粘贴操作的快捷键组合或从文本上下文菜单中选择“粘贴”时调度。InteractiveObject
 Inherited在组件初始化序列开始时调度。UIComponent
 Inherited使用 removeChild() 或 removeChildAt() 方法将组件作为内容子项从容器中删除时调度。UIComponent
 Inherited将要从显示列表中删除显示对象时调度。DisplayObject
 Inherited在从显示列表中直接删除显示对象或删除包含显示对象的子树时调度。DisplayObject
 Inherited[广播事件] 将要更新和呈现显示列表时调度。DisplayObject
 Inherited在调整组件大小时调度。UIComponent
 Inherited当用户在同一 InteractiveObject 上按下并释放用户指针设备的右按钮时调度。InteractiveObject
 Inherited当用户在 InteractiveObject 实例上按下指针设备按钮时调度。InteractiveObject
 Inherited当用户在 InteractiveObject 实例上释放指针设备按钮时调度。InteractiveObject
 Inherited用户将指针设备从 InteractiveObject 实例上移开时调度。InteractiveObject
 Inherited用户将指针设备移动到 InteractiveObject 实例上时调度。InteractiveObject
 Inherited当用户激活特定于平台的全选操作的快捷键组合或从文本上下文菜单中选择“全选”时调度。InteractiveObject
 Inherited当对象的状态从不可见变为可见时调度。UIComponent
 Inherited对象的 tabChildren 标志值发生更改时调度。InteractiveObject
 Inherited对象的 tabEnabled 标志发生更改时调度。InteractiveObject
 Inherited对象的 tabIndex 属性值发生更改时调度。InteractiveObject
 Inherited要创建 ToolTip 时由组件调度。UIComponent
 Inherited已隐藏组件的 ToolTip 并要将其放弃时由组件调度。UIComponent
 Inherited要隐藏组件的 ToolTip 时由组件调度。UIComponent
 Inherited要显示组件的 ToolTip 时由组件调度。UIComponent
 Inherited显示组件的 ToolTip 时由组件调度。UIComponent
 Inherited用户将鼠标移动到设置了 toolTip 属性的组件上方后,由该组件调度。UIComponent
 Inherited当调用了对象的 commitProperties()、measure() 和 updateDisplayList() 方法后调度(如果需要)。UIComponent
 Inherited当组件由 Validator 监控并且成功通过验证时调度。UIComponent
 Inherited当以编程方式或通过用户交互更改值时调度。UIComponent
样式
 样式 说明 定义方
 Inherited类型: String CSS 继承: no
从内容区域的上边缘到控件的基线位置的垂直距离(以像素为单位)。如果设置此样式,则组件的基线锚定在其内容区域的上边缘;调整组件容器大小后,这两个边缘将保持它们的间距。

此样式仅在 Canvas 容器中的组件上,或在 Panel 或 Application 容器(layout 属性设置为 absolute)中的组件上使用时才发挥作用。

默认值为 undefined,即不进行设置。

.
UIComponent
  
borderColor
类型: uint 格式: Color CSS 继承: no
边框颜色。下列控件支持此样式:Button、CheckBox、ComboBox、MenuBar、NumericStepper、ProgressBar、RadioButton、ScrollBar、Slider 以及任何支持 borderStyle 样式的组件。默认值取决于组件类;如果没有覆盖类的默认值,则默认值为 0xB7BABC
Button
 Inherited类型: String CSS 继承: no
从组件的下边缘到其内容区域的下边缘的垂直距离(以像素为单位)。如果设置此样式,则组件的下边缘锚定在其内容区域的下边缘;调整组件容器大小后,这两个边缘将保持它们的间距。

此样式仅在 Canvas 容器中的组件上,或在 Panel 或 Application 容器(layout 属性设置为 absolute)中的组件上使用时才发挥作用。

默认值为 undefined,即不进行设置。

.
UIComponent
  
color
类型: uint 格式: Color CSS 继承: yes
组件中文本(包括组件标签)的颜色。 默认值为 0x0B333C.
Button
  
cornerRadius
类型: Number 格式: Length CSS 继承: no
组件角的半径。下列组件支持此样式:Alert、Button、ComboBox、LinkButton、MenuBar、NumericStepper、Panel、ScrollBar、Tab、TitleWindow 以及任何支持设置为 "solid"borderStyle 属性的组件。默认值取决于组件类;如果没有覆盖类的默认值,则默认值为 0
Button
  
disabledColor
类型: uint 格式: Color CSS 继承: yes
禁用时组件中文本的颜色。 默认值为 0xAAB3B3.
Button
  
disabledIcon
类型: Class CSS 继承: no
类的名称,该类用作当禁用了按钮且未选择按钮时的图标。 默认值为 null.
Button
  
disabledSkin
类型: Class CSS 继承: no
类的名称,该类用作当未选择按钮且按钮已被禁用时背景和边框的外观。 默认值为 "mx.skins.halo.ButtonSkin".
Button
  
downIcon
类型: Class CSS 继承: no
类的名称,该类用作当未选择按钮而按下了鼠标按键时的图标。 默认值为 null.
Button
  
downSkin
类型: Class CSS 继承: no
类的名称,该类用作当未选择按钮而按下了鼠标按键时背景和边框的外观。 默认值为 "mx.skins.halo.ButtonSkin".
Button
 Inherited类型: uint 格式: Color CSS 继承: yes
验证失败时,组件加亮部分的颜色。验证失败时,Flex 还会将组件的 borderColor 样式设置为 errorColor。.
UIComponent
  
fillAlphas
类型: Array CSS 继承: no
用于填充控件背景的 Alpha。使用 [1, 1] 可使控件背景不透明。 默认值为 [ 0.6, 0.4 ].
Button
  
fillColors
类型: Array 格式: Color CSS 继承: no
为控件背景着色所使用的颜色。对具有均匀外观控件的两个值传递相同的颜色。 默认值为 [ 0xFFFFFF, 0xCCCCCC ].
Button
  
focusAlpha
类型: Number CSS 继承: no
指定焦点外观的 alpha 透明度值。 默认值为 0.4.
Button
 Inherited类型: String CSS 继承: no
焦点矩形使用的混合模式。有关详细信息,请参阅 flash.
UIComponent
  
focusRoundedCorners
类型: String CSS 继承: no
指定焦点矩形的哪些角应该是圆角。此值是使用空格分隔的 String,该 String 可以是 "tl""tr""bl""br" 的任意组合。例如,要指定右侧的角为圆角,左侧的角为直角,应使用 "tr br"cornerRadius 样式属性指定圆角的半径。默认值取决于组件类;如果未覆盖该类的默认值,则默认值为 "tl tr bl br"
Button
 Inherited类型: Class CSS 继承: no
用于绘制焦点矩形的外观。.
UIComponent
 Inherited类型: Number 格式: Length CSS 继承: no
焦点矩形轮廓的粗细,以像素为单位。.
UIComponent
  
fontAntiAliasType
类型: String CSS 继承: yes
设置内部 TextField 的 antiAliasType 属性。可能值为 "normal" (flash.text.AntiAliasType.NORMAL) 和 "advanced" (flash.text.AntiAliasType.ADVANCED)。

默认值为 "advanced",该值将启用字体的高级消除锯齿功能。设置为 "normal" 可禁用高级消除锯齿功能。

此样式对系统字体不起作用。

此样式适用于 TextField 子控件中的所有文本;但不能将其应用于部分字符。

默认值为 "advanced".

另请参见

Button
  
fontFamily
类型: String CSS 继承: yes
使用的字体的名称。与在完全 CSS 实现中不同,这里不支持逗号分隔的列表。您可以使用任何字体系列名称。如果您指定通用字体名称,它将转换为相应的设备字体。 默认值为 "Verdana".
Button
  
fontGridFitType
类型: String CSS 继承: yes
设置用于表示 Flex 控件文本的内部 TextField 的 gridFitType 属性。可能值为 "none" (flash.text.GridFitType.NONE)、"pixel" (flash.text.GridFitType.PIXEL) 和"subpixel" (flash.text.GridFitType.SUBPIXEL)。

仅当使用嵌入字体并将 fontAntiAliasType 属性设置为 "advanced" 时,才应用此属性。

此样式对系统字体不起作用。

此样式适用于 TextField 子控件中的所有文本;但不适用于部分字符。

默认值为 "pixel".

另请参见

Button
  
fontSharpness
类型: Number CSS 继承: yes
设置用于表示 Flex 控件文本的内部 TextField 的 sharpness 属性。此属性指定字型边缘的清晰度。可能值为从 -400 到 400 之间的数字。

仅当使用嵌入字体并将 fontAntiAliasType 属性设置为 "advanced" 时,才应用此属性。

此样式对系统字体不起作用。

此样式适用于 TextField 子控件中的所有文本;但不适用于部分字符。

默认值为 0.

另请参见

Button
  
fontSize
类型: Number 格式: Length CSS 继承: yes
文本的高度,以像素为单位。除 ColorPicker 控件之外,所有控件的默认值都为 10。ColorPicker 控件的默认值为 11。
Button
  
fontStyle
类型: String CSS 继承: yes
确定文本是否使用斜体。可识别的值为 "normal""italic"。 默认值为 "normal".
Button
  
fontThickness
类型: Number CSS 继承: yes
设置用于表示 Flex 控件文本的内部 TextField 的 thickness 属性。此属性指定字型边缘的粗细。可能值为从 -200 到 200 之间的数字。

仅当使用嵌入字体并将 fontAntiAliasType 属性设置为 "advanced" 时,才应用此属性。

此样式对系统字体不起作用。

此样式适用于 TextField 子控件中的所有文本;但不适用于部分字符。

默认值为 0.

另请参见

Button
  
fontWeight
类型: String CSS 继承: yes
确定文本是否使用粗体。可识别的值为 normalbold。Button 控件的默认值为 bold。所有其它控件的默认值为 normal
Button
  
highlightAlphas
类型: Array CSS 继承: no
Alpha 透明度,用于加亮填充控件。第一个值指定加亮部分顶部的透明度,第二个值指定加亮部分底部的透明度。加亮部分覆盖了外观的上半部分。 默认值为 [ 0.3, 0.0 ].
Button
 Inherited类型: String CSS 继承: no
从组件内容区域的中心到组件中心的水平距离(以像素为单位)。如果设置此样式,则组件的中心锚定在其内容区域的中心;调整组件容器大小后,这两个中心将保持它们的水平间距。

此样式仅在 Canvas 容器中的组件上,或在 Panel 或 Application 容器(layout 属性设置为 absolute)中的组件上使用时才发挥作用。

默认值为 undefined,即不进行设置。

.
UIComponent
  
horizontalGap
类型: Number 格式: Length CSS 继承: no
labelPlacement 属性设置为 leftright 时,标签和图标之间的间隙。 默认值为 2.
Button
  
icon
类型: Class CSS 继承: no
用作默认图标的类的名称。设置任何其它图标样式将覆盖此设置。 默认值为 null.

您可以使用外观样式来为以下外观状态指定外观: up, over, down, disabled, selectedUp, selectedOver, selectedDown, selectedDisabled.
Button
  
kerning
类型: Boolean CSS 继承: yes
一个布尔值,指示是启用 (true) 还是禁用 (false) 字距调整。字距调整会调整某些字符对之间的间隔以提高可读性,并应只在必要时(例如使用大字体标题时)使用。仅嵌入字体支持字距调整。某些字体(如宋体)和等宽字体(如 Courier New)不支持字距调整。 默认值为 false.
Button
  
leading
类型: Number 格式: Length CSS 继承: yes
文本行之间附加的垂直空间。

默认值为 2。

ComboBox 控件的默认值为 0。

Button
 Inherited类型: String CSS 继承: no
从组件内容区域的左边缘到组件左边缘的水平距离(以像素为单位)。如果设置此样式,则组件的左边缘锚定在其内容区域的左边缘;调整组件容器大小后,这两个边缘将保持它们的间距。

此样式仅在 Canvas 容器中的组件上,或在 Panel 或 Application 容器(layout 属性设置为 absolute)中的组件上使用时才发挥作用。

默认值为 undefined,即不进行设置。

.
UIComponent
  
letterSpacing
类型: Number CSS 继承: yes
各字符之间显示的附加像素数。如果为正值,则会在正常间距的基础上增加字符间距;如果为负值,则减小此间距。 默认值为 0.
Button
  
overIcon
类型: Class CSS 继承: no
类的名称,该类用作当未选择按钮且鼠标光标停在控件位置时的图标。 默认值为 null.
Button
  
overSkin
类型: Class CSS 继承: no
类的名称,该类用作当未选择按钮且鼠标光标停在控件位置时背景和边框的外观。 默认值为 "mx.skins.halo.ButtonSkin".
Button
  
paddingBottom
类型: Number 格式: Length CSS 继承: no
组件下边框与内容区域底部之间的像素数目。 默认值为 0.
Button
  
paddingLeft
类型: Number 格式: Length CSS 继承: no
组件左边框与其内容区域左边缘之间的像素数目。

默认值为 0。

Button 控件的默认值为 10。

ComboBox 控件的默认值为 5。

Form 容器的默认值为 16。

Tree 控件的默认值为 2。

Button
  
paddingRight
类型: Number 格式: Length CSS 继承: no
组件右边框与其内容区域右边缘之间的像素数目。

默认值为 0。

Button 控件的默认值为 10。

ComboBox 控件的默认值为 5。

Form 容器的默认值为 16。

Button
  
paddingTop
类型: Number 格式: Length CSS 继承: no
组件上边框与内容区域顶部之间的像素数目。 默认值为 0.
Button
  
repeatDelay
类型: Number 格式: Time CSS 继承: no
在第一个 buttonDown 事件之后,以及相隔每个 repeatInterval 重复一次 buttonDown 事件之前,需要等待的毫秒数。 默认值为 500.
Button
  
repeatInterval
类型: Number 格式: Time CSS 继承: no
用户在按钮上按住鼠标时,buttonDown 事件之间相隔的毫秒数。 默认值为 35.
Button
 Inherited类型: String CSS 继承: no
从组件的右边缘到其内容区域的右边缘的水平距离(以像素为单位)。如果设置此样式,则组件的右边缘锚定在其内容区域的右边缘;调整组件容器大小后,这两个边缘将保持它们的间距。

此样式仅在 Canvas 容器中的组件上,或在 Panel 或 Application 容器(layout 属性设置为 absolute)中的组件上使用时才发挥作用。

默认值为 undefined,即不进行设置。

.
UIComponent
  
selectedDisabledIcon
类型: Class CSS 继承: no
类的名称,该类用作当选择了按钮而按钮已被禁用时的图标。 默认值为 null.
Button
  
selectedDisabledSkin
类型: Class CSS 继承: no
类的名称,该类用作当选择了切换按钮而切换按钮已被禁用时背景和边框的外观。 默认值为 "mx.skins.halo.ButtonSkin".
Button
  
selectedDownIcon
类型: Class CSS 继承: no
类的名称,该类用作当选择了按钮且按下了鼠标按键时的图标。 默认值为 null.
Button
  
selectedDownSkin
类型: Class CSS 继承: no
类的名称,该类用作当选择了切换按钮且按下了鼠标按键时背景和边框的外观。 默认值为 "mx.skins.halo.ButtonSkin".
Button
  
selectedOverIcon
类型: Class CSS 继承: no
类的名称,该类用作当选择了按钮且鼠标光标停在控件位置时的图标。 默认值为 null.
Button
  
selectedOverSkin
类型: Class CSS 继承: no
类的名称,该类用作当选择了切换按钮且鼠标光标停在控件位置时背景和边框的外观。 默认值为 "mx.skins.halo.ButtonSkin".
Button
  
selectedUpIcon
类型: Class CSS 继承: no
类的名称,该类用作当选择了按钮且松开了鼠标按键时的图标。 默认值为 null.
Button
  
selectedUpSkin
类型: Class CSS 继承: no
类的名称,该类用作当选择了切换按钮且鼠标光标未停在控件位置时背景和边框的外观。 默认值为 "mx.skins.halo.ButtonSkin".
Button
  
skin
类型: Class CSS 继承: no
用作背景和边框默认外观的类的名称。 默认值为 "mx.skins.halo.ButtonSkin".

您可以使用外观样式来为以下外观状态指定外观: up, over, down, disabled, selectedUp, selectedOver, selectedDown, selectedDisabled.
Button
  
textAlign
类型: String CSS 继承: yes
容器内文本的对齐情况。可能值有:"left""right""center"

大多数组件的默认值为 "left"。对于 FormItem 组件,默认值为 "right"。对于 Button、LinkButton 和 AccordionHeader 组件,默认值为 "center",且仅当将 labelPlacement 属性设置为 "left""right" 时,才能识别此属性。如果将 labelPlacement 设置为 "top""bottom",将居中文本及所有图标。

Button
  
textDecoration
类型: String CSS 继承: yes
确定文本是否加下划线。可能值有:"none""underline"。 默认值为 "none".
Button
  
textIndent
类型: Number 格式: Length CSS 继承: yes
文本第一行偏离容器左侧的距离(以像素为单位)。 默认值为 0.
Button
  
textRollOverColor
类型: uint 格式: Color CSS 继承: yes
当用户将鼠标指针移动到按钮位置时,标签的文本颜色。 默认值为 0x2B333C.
Button
  
textSelectedColor
类型: uint 格式: Color CSS 继承: yes
当用户按下标签时,标签的文本颜色。 默认值为 0x000000.
Button
 Inherited类型: uint 格式: Color CSS 继承: yes
组件的主题颜色。此属性控制加亮内容的外观、选中组件时的外观和其它相似的形象化提示,但是它对此组件的常规边框和背景颜色不起作用。虽然可以使用任意有效的颜色值,但首选值为 haloGreenhaloBluehaloOrangehaloSilver

rollOverColorselectionColor 样式的默认值基于 themeColor 值。

.
UIComponent
 Inherited类型: String CSS 继承: no
从控件内容区域的上边缘到组件上边缘的垂直距离(以像素为单位)。如果设置此样式,则组件的上边缘锚定在其内容区域的上边缘;调整其容器大小后,这两个边缘将保持其间距。

此样式仅在 Canvas 容器中的组件上,或在 Panel 或 Application 容器(layout 属性设置为 absolute)中的组件上使用时才发挥作用。

默认值为 undefined,即不进行设置。

.
UIComponent
  
upIcon
类型: Class CSS 继承: no
类的名称,该类用作当未选择切换按钮且鼠标光标不在按钮上方时的图标。 默认值为 null.
Button
  
upSkin
类型: Class CSS 继承: no
类的名称,该类用作当未选择按钮且鼠标光标未停在控件位置时背景和边框的外观。 默认值为 "mx.skins.halo.ButtonSkin".
Button
 Inherited类型: String CSS 继承: no
从组件内容区域的中心到组件中心的垂直距离(以像素为单位)。如果设置此样式,则组件的中心锚定在其内容区域的中心;调整其容器大小后,这两个中心将保持其垂直间距。

此样式仅在 Canvas 容器中的组件上,或在 Panel 或 Application 容器(layout 属性设置为 absolute)中的组件上使用时才发挥作用。

默认值为 undefined,即不进行设置。

.
UIComponent
  
verticalGap
类型: Number 格式: Length CSS 继承: no
labelPlacement 属性设置为 "top""bottom" 时,按钮的标签和图标之间的间隙。 默认值为 2.
Button
效果
 效果 说明 定义方
 Inherited 触发事件: added
将组件作为子项添加到 Container 时播放。
UIComponent
 Inherited 触发事件: creationComplete
创建组件时播放。
UIComponent
 Inherited 触发事件: focusIn
组件获得键盘焦点时播放。
UIComponent
 Inherited 触发事件: focusOut
组件失去键盘焦点时播放。
UIComponent
 Inherited 触发事件: hide
组件变为不可见时播放。
UIComponent
 Inherited 触发事件: mouseDown
用户在组件上方按下鼠标按键时播放。
UIComponent
 Inherited 触发事件: mouseUp
用户在组件上方释放鼠标按键时播放。
UIComponent
 Inherited 触发事件: move
移动组件时播放。
UIComponent
 Inherited 触发事件: removed
从 Container 中删除组件时播放。
UIComponent
 Inherited 触发事件: resize
调整组件大小时播放。
UIComponent
 Inherited 触发事件: rollOut
用户将鼠标指针滚离组件上方时播放。
UIComponent
 Inherited 触发事件: rollOver
用户将鼠标指针滚动到组件上方时播放。
UIComponent
 Inherited 触发事件: show
组件变为可见时播放。
UIComponent
公共常量
 常量定义方
 InheritedDEFAULT_MAX_HEIGHT : Number = 10000
[静态] maxHeight 属性的默认值。
UIComponent
 InheritedDEFAULT_MAX_WIDTH : Number = 10000
[静态] maxWidth 属性的默认值。
UIComponent
 InheritedDEFAULT_MEASURED_HEIGHT : Number = 22
[静态] measuredHeight 属性的默认值。
UIComponent
 InheritedDEFAULT_MEASURED_MIN_HEIGHT : Number = 22
[静态] measuredMinHeight 属性的默认值。
UIComponent
 InheritedDEFAULT_MEASURED_MIN_WIDTH : Number = 40
[静态] measuredMinWidth 属性的默认值。
UIComponent
 InheritedDEFAULT_MEASURED_WIDTH : Number = 160
[静态] measuredWidth 属性的默认值。
UIComponent
属性详细信息
autoRepeat属性
autoRepeat:Boolean  [读写]

指定在用户按住鼠标按键时是否重复调度 buttonDown 事件。

默认值为 false.



实现
    public function get autoRepeat():Boolean
    public function set autoRepeat(value:Boolean):void
data属性 
data:Object  [读写]

当您将某个组件用作项目渲染器或项目编辑器时,可借助 data 属性向该组件传递值。您通常使用数据绑定将 data 属性的字段绑定到此组件的某个属性。

当您使用此控件作为嵌入式项目渲染器或嵌入式项目编辑器时,Flex 会自动将此项目的当前值写入此控件的 selected 属性。

不要以 MXML 方式设置此属性。

默认值为 null.

此属性可用作数据绑定的源。修改此属性后,将调度 dataChange 事件。



实现
    public function get data():Object
    public function set data(value:Object):void

另请参见

emphasized属性 
emphasized:Boolean  [读写]

当 Button 控件处于弹起状态并且 emphasized 设置为 true 时,在该控件周围绘制宽边框。

默认值为 false.



实现
    public function get emphasized():Boolean
    public function set emphasized(value:Boolean):void
fontContext属性 
fontContext:IFlexModuleFactory  [读写]

为此组件提供字体上下文的模块工厂。



实现
    public function get fontContext():IFlexModuleFactory
    public function set fontContext(value:IFlexModuleFactory):void
label属性 
label:String  [读写]

要在 Button 控件上显示的文本。

如果标签宽于 Button 控件,则截断此标签并使用省略号 (...) 终止。当用户将鼠标移至 Button 控件位置时,将显示完整标签作为工具提示。如果您还使用 tooltip 属性设置了工具提示,则显示工具提示而不是标签文本。

默认值为 "".

此属性可用作数据绑定的源。修改此属性后,将调度 labelChanged 事件。



实现
    public function get label():String
    public function set label(value:String):void
labelPlacement属性 
labelPlacement:String  [读写]

标签相对于指定图标的方向。有效的 MXML 值是 rightleftbottomtop

在 ActionScript 中,您可以使用下列常数来设置此属性:ButtonLabelPlacement.RIGHTButtonLabelPlacement.LEFTButtonLabelPlacement.BOTTOMButtonLabelPlacement.TOP

默认值为 ButtonLabelPlacement.RIGHT.

此属性可用作数据绑定的源。修改此属性后,将调度 labelPlacementChanged 事件。



实现
    public function get labelPlacement():String
    public function set labelPlacement(value:String):void
listData属性 
listData:BaseListData  [读写]

使用组件作为嵌入式项目渲染器或嵌入式项目编辑器时,Flex 将使用 list 控件中的相应数据初始化该组件的 listData 属性。然后,组件可使用 listData 属性初始化嵌入式项目渲染器或嵌入式项目编辑器的 data 属性。

您无需在 MXML 或 ActionScript 中设置此属性;将组件用作嵌入式项目渲染器或嵌入式项目编辑器时,Flex 会对其进行设置。

默认值为 null.

此属性可用作数据绑定的源。修改此属性后,将调度 dataChange 事件。



实现
    public function get listData():BaseListData
    public function set listData(value:BaseListData):void

另请参见

selected属性 
selected:Boolean  [读写]

指示切换按钮是处于启用状态 (true) 还是禁用状态 (false)。仅在以下情况才能设置此属性:toggle 属性设置为 true 时。

对于 CheckBox 控件,指示框中是否显示了选中标记。对于 RadioButton 控件,指示是否已选中该控件。

用户可以通过单击控件来更改此属性,但也可通过编程方式来设置此属性。

在早期版本中,如果将 toggle 属性设置为 true,则更改此属性还会调度 change 事件。从 3.0 版开始,以编程方式设置此属性仅调度 valueCommit 事件。

默认值为 false.

此属性可用作数据绑定的源。修改此属性后,将调度 valueCommit 事件。



实现
    public function get selected():Boolean
    public function set selected(value:Boolean):void
selectedField属性 
public var selectedField:String = "null"

data 属性中用于为 Button 控件的 selected 属性指定值的字段的名称。在项目渲染器中使用 Button 控件时即可设置此属性。默认值为 null,这意味着 Button 控件不是基于 data 属性中的属性设置其选择状态。

默认值为 null.

stickyHighlighting属性 
public var stickyHighlighting:Boolean = false

如果为 false,则 Button 会在用户按下它时显示其按下时的外观,但在用户将鼠标拖离它时将改为显示整体外观。如果为 true,则 Button 会在用户按下它时显示其按下时的外观,并在用户将鼠标拖离时继续显示此外观。

Button 子类(如 SliderThumb 和 ScrollThumb 类或 ScrollBar 的向上和向下箭头)将此属性设置为 true

默认值为 false.

textField属性 
protected var textField:IUITextField

呈现此 Button 的标签的内部 UITextField 对象。

默认值为 null.

toggle属性 
toggle:Boolean  [读写]

控制 Button 是否处于切换状态。如果为 true,则单击此按钮将在选中状态和未选中状态之间切换。可以通过编程方式获取或设置此状态,方法是使用selected 属性。如果为 false,则用户释放按钮后,按钮不再保持按下状态。在这种情况下,它的 selected 属性始终为 false。此类按钮均用于执行操作。将 toggle 设置为 false 时,会强制将 selected 设置为 false,因为只能选择切换按钮。

默认值为 false.

此属性可用作数据绑定的源。修改此属性后,将调度 toggleChanged 事件。



实现
    public function get toggle():Boolean
    public function set toggle(value:Boolean):void
构造函数详细信息
Button()构造函数
public function Button()

构造函数。

方法详细信息
clickHandler()方法
protected function clickHandler(event:MouseEvent):void

MouseEvent.CLICK 事件的默认处理函数。

参数

event:MouseEvent — 事件对象。

mouseDownHandler()方法 
protected function mouseDownHandler(event:MouseEvent):void

MouseEvent.MOUSE_DOWN 事件的默认处理函数。

参数

event:MouseEvent — 事件对象。

mouseUpHandler()方法 
protected function mouseUpHandler(event:MouseEvent):void

MouseEvent.MOUSE_UP 事件的默认处理函数。

参数

event:MouseEvent — 事件对象。

rollOutHandler()方法 
protected function rollOutHandler(event:MouseEvent):void

MouseEvent.ROLL_OUT 事件的默认处理函数。

参数

event:MouseEvent — 事件对象。

rollOverHandler()方法 
protected function rollOverHandler(event:MouseEvent):void

MouseEvent.ROLL_OVER 事件的默认处理函数。

参数

event:MouseEvent — 事件对象。

事件详细信息
buttonDown 事件
事件对象类型: mx.events.FlexEvent
属性 FlexEvent.type = mx.events.FlexEvent.BUTTON_DOWN

当用户按压 Button 控件时调度。如果 autoRepeat 属性为 true,则只要按钮处于按下状态,就将重复调度此事件。

FlexEvent.BUTTON_DOWN 常数可为 buttonDown 事件定义事件对象的 type 属性值。

事件对象的属性有下列值:

属性
bubbles false
cancelable false
currentTarget 用于定义处理该事件的事件侦听器的 Object。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。
target 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。
change 事件  
事件对象类型: flash.events.Event
属性 Event.type = flash.events.Event.CHANGE

当切换 Button 控件的 selected 属性发生更改时调度。切换 Button 控件需要将 toggle 属性设置为 true。对于 RadioButton 控件,当 selected 属性发生更改时调度此事件。对于 CheckBox 控件,仅当用户使用鼠标与控件进行交互时调度此事件。

Event.CHANGE 常量定义 change 事件对象的 type 属性值。

此事件具有以下属性:

属性
bubbles true
cancelable false;没有要取消的默认行为。
currentTarget 当前正在使用某个事件侦听器处理 Event 对象的对象。
target 已修改其值的对象。target 不一定是显示列表中注册此事件侦听器的对象。请使用 currentTarget 属性来访问显示列表中当前正在处理此事件的对象。
dataChange 事件  
事件对象类型: mx.events.FlexEvent
属性 FlexEvent.type = mx.events.FlexEvent.DATA_CHANGE

data 属性更改时进行调度。

当您使用组件作为项目渲染器时,data 属性将包含要显示的数据。您可以侦听此事件,并在 data 属性更改时更新组件。

FlexEvent.DATA_CHANGE 常数可为 dataChange 事件定义事件对象的 type 属性值。

事件对象的属性有下列值:

属性
bubbles false
cancelable false
currentTarget 用于定义处理该事件的事件侦听器的 Object。例如,如果您使用 myButton.addEventListener() 注册某个事件侦听器,则 myButton 为 currentTarget 的值。
target 调度该事件的 Object;它不一定是侦听该事件的 Object。使用 currentTarget 属性始终可以访问侦听事件的 Object。
示例 如何使用示例
ButtonExample.mxml
<?xml version="1.0"?>
<!-- Simple example to demonstrate the Button control. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <![CDATA[

            import flash.events.Event;

            // Event handler function to print a message
            // describing the selected Button control.
            private function printMessage(event:Event):void  {
              message.text += event.target.label + " pressed" + "\n";
            }

      ]]>
    </mx:Script>

    <mx:Panel title="Button Control Example"
        height="75%" width="75%" layout="horizontal"
        paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">

        <mx:VBox>
            <mx:Label width="100%" color="blue"
                text="Select a Button control."/>

             <!-- The button can contain an image, as in the "Button with Icon" button -->
             <!-- The button can contain an image, as in the "Button with Icon" button -->
             <mx:Button id="iconButton" icon="@Embed('assets/mm-icon.png')" label="Button with Icon"
                 paddingLeft="12" paddingRight="18" labelPlacement="right" color="#993300" click="printMessage(event);"/>

             <!-- The size of the button and the label attributes can be customized -->
             <mx:Button label="Customized Button" color="#993300" toggle="true" selected="true"
                 textAlign="left" fontStyle="italic" fontSize="13" width="{iconButton.width}"
                 click="printMessage(event);"/>

             <!-- By default, the look and feel of the customized button is
                 similar to the Default Button.  -->
             <mx:Button label="Default Button" click="printMessage(event);"/>
        </mx:VBox>

         <mx:TextArea id="message" text="" editable="false" height="100%" width="100%"
             color="#0000FF"/>

    </mx:Panel>
</mx:Application>