SkinnableComponent 的子类必须覆盖此方法才可返回值。
<s:Range>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:Range Properties maximum="100" minimum="0" snapInterval="1" stepSize="1" value="0" />]]>
Range 是需要 range 功能的各种控件(包括 TrackBase 和 Spinner)的基类。
如果
范围的有效值由
例如,如果
对
此方法假定调用者已经使用了
例如,如果
如果此属性的值为零,则仅会将有效值约束到介于 minimum 和 maximum 之间(包括两者)。
此属性还约束
<s:ToggleButtonBase>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:ToggleButtonBase Properties selected="false" events change="No default" />]]>
<s:ItemRenderer>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:ItemRenderer Properties autoDrawBackground="true" selected="false" showsCaret="false" />]]>
项呈示器支持可选视图状态。您通常在 MXML 项呈示器中使用视图状态,来基于与项的用户交互控制数据项的外观。ItemRenderer 类支持所有视图状态,因此您可以使用这些项呈示器处理基于列表的类。
Flex 定义在您的项呈示器中支持的以下视图状态:
当用户以更改项呈示器的视图状态的方式与控件交互时,Flex 首先确定呈示器是否定义该视图状态。如果项呈示器支持视图状态,Flex 将设置项呈示器以使用该视图状态。如果项呈示器不支持视图状态,则 Flex 不执行任何操作。
如果所需的行为与默认行为不同,则 ItemRenderer 的子类必须覆盖此方法以返回值。
在 Flex 4.0 中,三种主要状态为“normal”、“hovered”和“selected”。在 Flex 4.5 中,添加了“down”和“downAndSelected”。
支持的完整状态集如下所示(按照优先级的顺序):
如果为
如果为
项呈示器的主机组件可以使用
对于诸如 List 和 ButtonBar 等控件,可以使用
<s:GroupBase>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:GroupBase Properties autoLayout="true" clipAndEnableScrolling="false" horizontalScrollPosition="null" luminosityClip="false" luminosityInvert="false" layout="BasicLayout" mask="" maskType="clip" mouseEnabledWhereTransparent="true" resizeMode="noScale" verticalScrollPosition="no default" Styles accentColor="0x0099FF" alignmentBaseline="useDominantBaseline" alternatingItemColors="undefined" baselineShift="0" blockProgression="tb" breakOpportunity="auto" cffHinting="horizontalStem" chromeColor="0xCCCCCC" color="0x000000" contentBackgroundAlpha="1.0" contentBackgroundColor="0xFFFFFF" clearFloats="none" digitCase="default" digitWidth="default" direction="ltr" disabledAlpha="0.5" dominantBaseline="auto" firstBaselineOffset="auto" focusColor="0x70B2EE" focusedTextSelectionColor="A8C6EE" fontFamily="Arial" fontLookup="device" fontSize="12" fontStyle="normal" fontWeight="normal" inactiveTextSelectionColor="E8E8E8" justificationRule="auto" justificationStyle="auto" kerning="auto" leadingModel="auto" ligatureLevel="common" lineHeight="120%" lineThrough="false" listAutoPadding="40" listStylePosition="outside" listStyleType="disc" locale="en" paragraphEndIndent="0" paragraphSpaceAfter="0" paragraphSpaceBefore="0" paragraphStartIndent="0" renderingMode="cff" rollOverColor="0xCEDBEF" symbolColor="0x000000" tabStops="null" textAlign="start" textAlignLast="start" textAlpha="1" textDecoration="none" textIndent="0" textJustify="interWord" textRotation="auto" trackingLeft="0" trackingRight="0" typographicCase="default" unfocusedTextSelectionColor="0xE8E8E8" whiteSpaceCollapse="collapse" wordSpacing="100%,50%,150%" />]]>
如果尚未设置布局对象,则 createChildren() 会为该容器指定默认布局对象 BasicLayout。
该实现调用
该实现调用
如果要返回的元素尚不是可见子项(即,如果已创建或循环使用它,且指定了 eltWidth 或 eltHeight),则会在验证元素之前使用 setLayoutBoundsSize() 设置元素的初始大小。这对于将布局对齐到 Group 的宽度或高度时会重排的组件(如文本)很重要。
返回的布局元素已经过验证。
此方法将根据需要延迟创建或“循环使用”并验证布局元素。
此方法不能直接进行调用,支持虚拟化的布局将对其进行调用。
遮罩类型。可能的值为
剪辑遮罩
遮罩处于剪辑模式下时,会将剪辑遮罩减少至 1 位。这意味着遮罩将不会影响源内容中像素的不透明度;它要么保留值不进行修改(如果遮罩中的相应像素具有非零 Alpha 值),要么使其完全透明(如果遮罩像素值为零 Alpha 值)。
Alpha 遮罩
在 Alpha 模式下,会将源内容中的每个像素的不透明度与遮罩的相应区域的不透明度相乘。即,对于由不透明度为 0.5 的区域遮罩的、源内容中不透明度为 1 的像素,其结果不透明度将为 0.5。对于由不透明度为 0.5 的区域遮罩的、不透明度为 0.8 的源像素,其结果不透明度为 0.4。
发光度遮罩
发光度遮罩有时称为“柔化遮罩”,除以下方面外其作用极其类似于 Alpha 遮罩:源内容中像素的不透明度和 RGB 颜色值与遮罩中相应区域的不透明度和 RGB 颜色值相乘。
发光度遮罩不是 Flash 的特有功能,但在诸如 Adobe Illustrator 和 Adobe Photoshop 等 Adobe Creative Suite 工具中通用。为了实现 Flash 呈示内容中发光度遮罩的视觉效果,指定发光度遮罩的图形元素实际上会实例化模仿发光度遮罩在 Adobe Creative Suite 工具中呈示时其可视外观的着色器滤镜。
由发光度遮罩设置遮罩的对象可以设置用于控制遮罩 RGB 颜色值和剪辑的属性。请参阅 luminosityInvert 和 luminosityClip 属性。
注意:请不要保留此对象,因为此 Group 会根据需要破坏和创建该对象。
默认值为对应于“noScale”的
通过设置 component 类的
MyComponent { skinClass: ClassReference("my.skins.MyComponentSkin") }
以下示例在 MXML 中设置
<MyComponent skinClass="my.skins.MyComponentSkin"/>
此方法实例化组件的外观,将外观添加为组件的子项,并解析外观的所有部件关联
通常,SkinnableComponent 的子类不覆盖此方法。
通常,SkinnableComponent 的子类不覆盖此方法。
SkinnableComponent 的子类必须覆盖此方法才可返回值。
覆盖此函数以将行为附加到该部件。如果希望覆盖从某个基类继承的外观部件上的行为,请不要调用
覆盖此函数以从该部件删除行为。
除了添加
截断文本意味着使用截断指示符(如 "...")替换超额文本。截断指示符与区域设置相关;它是由 "core" 资源包中的 "truncationIndicator" 资源指定的。
如果
如果
如果
仅当
截断文本意味着使用截断指示符(如 "...")替换超额文本。截断指示符与区域设置相关;它是由 "core" 资源包中的 "truncationIndicator" 资源指定的。
如果值为 0,则不会发生截断。相反,如果文本不在组件的界限内,则将只是剪辑文本。
如果值为正整数,则会根据需要截断文本以将行数减少至此整数。
如果值为 -1,则会截断该文本以显示将完全放在组件的高度内的行。
仅当
此文本的格式是由 CSS 样式控制的。支持的样式取决于子类。
<s:ScrollBarBase>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:ScrollBarBase Properties pageSize="20" snapInterval="1" viewport="null" Styles autoThumbVisibility="true" fixedThumbSize="false" repeatDelay="500" repeatInterval="35" smoothScrolling="true" symbolColor="0x000000" />]]>
此控件扩展 TrackBase 类,且是 HScrollBar 和 VScrollBar 控件的基类。
滚动条由一个轨道、一个可变大小滚动滑块和两个可选箭头按钮组成。ScrollBarBase 类使用四个参数计算其显示状态:
如果
即使
VScrollBar 和 HScrollBar 类覆盖这些方法以保持其
例如,如果
如果此属性的值为零,则仅会将有效值约束到介于 minimum 和 maximum 之间(包括两者)。
此属性还约束
<s:ButtonBase>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:ButtonBase Properties autoRepeat="false" content="null" label="" stickyHighlighting="false" Events buttonDown="No default" Styles alignmentBaseline="USE_DOMINANT_BASELINE" cffHinting="HORIZONTAL_STEM" color="0" cornerRadius="4" digitCase="DEFAULT" digitWidth="DEFAULT" direction="LTR" dominantBaseline="AUTO" focusAlpha="0.5" focusColor="0x70B2EE" fontFamily="Arial" fontLookup="DEVICE" fontSize="12" fontStyle="NORMAL" fontWeight="NORMAL" justificationRule="AUTO" justificationStyle="AUTO" kerning="AUTO" ligatureLevel="COMMON" lineHeight="120%" lineThrough="false" locale="en" renderingMode="CFF" repeatDelay="500" repeatInterval="35" textAlign="START" textAlignLast="START" textAlpha="1" textDecoration="NONE" textJustify="INTER_WORD" trackingLeft="0" trackingRight="0" typographicCase="DEFAULT" wordSpacing="100%" />]]>
调用此方法以处理
如果标签比 ButtonBase 控件宽,则使用省略号 (...) 截断此标签并终止。当用户将鼠标移到控件上时,将完整标签显示为工具提示。如果您还使用
这是默认的 ButtonBase 属性。
此属性是
<s:TrackBase>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:TrackBase Styles slideDuration="300" Events change="No default" changing="No default" thumbDrag="No default" thumbPress="No default" thumbRelease="No default" />]]>
TrackBase 子类必须覆盖此方法并执行将它们自己的几何图形考虑在内的转换。例如,一个垂直滑块可能会按如下方式计算值:
return (y / track.height) (maximum - minimum);
默认情况下,此方法返回
大多数子类覆盖此方法以基于
默认情况下,此方法不执行任何操作。
<s:SliderBase>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:SliderBase Properties dataTipFormatFunction="20" dataTipPrecision="2" maximum="10" showDataTip="true" Styles alignmentBaseline="USE_DOMINANT_BASELINE" baselineShift="0.0" cffHinting="HORIZONTAL_STEM" color="0" digitCase="DEFAULT" digitWidth="DEFAULT" direction="LTR" dominantBaseline="AUTO" focusAlph="0.55" focusColor="0xFFFFFF" fontFamily="Arial" fontLookup="DEVICE" fontSize="12" fontStyle="NORMAL" fontWeight="NORMAL" justificationRule="AUTO" justificationStyle="AUTO" kerning="AUTO" ligatureLevel="COMMON" lineHeight="120%" lineThrough="false" liveDragging="true" local="en" renderingMode="CFF" textAlignLast="START" textAlpha="1" textDecoration="NONE" textJustify="INTER_WORD" trackingLeft="0" trackingRight="0" typographicCase="DEFAULT" />]]>
此函数包含下列签名:
funcName(value:Number):Object
以下示例采用美元符号作为数据提示文本的前缀,并使用名为“slide”的 SliderBase 控件的
import mx.formatters.NumberBase; function myDataTipFormatter(value:Number):Object { var dataFormatter:NumberBase = new NumberBase(".", ",", ".", ""); return "$ " + dataFormatter.formatPrecision(String(value), slide.dataTipPrecision); }
如果
即使
通常将 skin 类写入 MXML 中,如以下示例所示:
<?xml version="1.0"?> <Skin xmlns="http://ns.adobe.com/mxml/2009"> <Metadata> <!-- Specify the component that uses this skin class. --> [HostComponent("my.component.MyComponent")] </Metadata> <states> <!-- Specify the states controlled by this skin. --> </states> <!-- Define skin. --> </Skin>
该布局尝试将所有子代的大小调整为其首选大小。如果有足够的空间,则会将每个子代设置为其首选大小,并加上在子代之间平均分配的任何额外空间。
如果存在的空间不足以将所有子代调整为其首选大小,则将为小于平均宽度的子代分配其首选大小,剩余的元素将平均减小。
将所有子代设置为父代的高度。
用户当前正在按着此组件。
用户当前正在悬停于此组件上。
此组件上未发生交互。
<s:ButtonBarBase>
tag inherits all of the tag
attributes of its superclass and adds no new tag attributes:
<s:ButtonBarBase/>]]>
通过设置
调整
ButtonBarBase 对象具有焦点且由于键盘动作而到达
初始化 Tab 键处理:按 Tab 键选择此组件使其获得焦点,而不是鼠标单击。禁用按 Tab 键选择子代。
您可以提供一个
icon 函数仅使用数据提供程序中的某个项目作为唯一参数,并返回一个有效的 BitmapImage 源。
myIconFunction(item:Object):Object
<s:ListBase>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:ListBase Properties arrowKeysWrapFocus="false" labelField="label" labelFunction="null" requireSelection="false" selectedIndex="-1" selectedItem="undefined" useVirtualLayout="false" Events caretChange="No default" change="No default" changing="No default" />]]>
注意:基于 Spark List 的控件(Spark ListBase 类及其子类,如 ButtonBar、ComboBox、DropDownList、List 和 TabBar)不支持将 BasicLayout 类作为
以编程方式更改
当用户与此控件交互时,将分派此事件。以编程方式更改
在下次调用
调整
您可以提供一个
label 函数仅使用数据提供程序中的某个项目作为唯一参数,并返回一个 String。
myLabelFunction(item:Object):String
对于大多数子类(除了 TabBar),默认值为
该值始终在 -1 和 (
如果已删除选定项目,则将选定索引设置为:
当用户通过与控件交互来更改
将
如果已删除选定项目,则将选定项目设置为:
当用户通过与控件交互来更改
当状态改变时,如果应播放转换,则为 playTransitions。
可能的值包括:
<s:DropDownListBase>
tag inherits all of the tag
attributes of its superclass and adds the following attributes:
<s:DropDownListBase Styles cornerRadius="4" dropShadowVisible="true" Events closed="No default" open="No default" />]]>
DropDownListBase 控件由锚点按钮和下拉列表构成。使用锚点按钮可打开和关闭下拉列表。
打开下拉列表时:
<s:SkinnableTextBase>
tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:
<s:SkinnableTextBase autoCapitalize="none" [Mobile theme only] autoCorrect="true" [Mobile theme only] displayAsPassword="false" editable="true" imeMode="null" [Spark theme only] maxChars="0" prompt="null" restrict="null" returnLabelKey="default" [Mobile theme only] selectable="true" selectionHighlighting="whenFocused" [Spark theme only] softKeyBoardType="default" [Mobile theme only] text="" typicalText="null" [Spark theme only] Styles borderAlpha="1.0" borderColor="0x696969" borderVisible="true" contentBackgroundAlpha="1.0" contentBackgroundColor="0xFFFFFF" focusAlpha="0.55" focusColor="0x70B2EE" showPromptWhenFocused="true" Events change="No default" changing="No default" [Spark theme only] selectionChange="No default" [Spark theme only] textInput="No default" [Spark theme only] />]]>
对于 Mobile 主题,不调度此项。
对于 Mobile 主题,不调度此项。
对于 Mobile 主题,不调度此项。
支持的值在 flash.text.AutoCapitalize 中定义:
对于 Spark 主题,它不受支持。
对于 Spark 主题,它不受支持。
有关 Spark 主题,请参阅 spark.components.RichEditableText.editable。
对于 Mobile 主题,请参阅 spark.components.supportClasses.StyleableStageText.editable
对于 Mobile 主题,它不受支持。
有关 Spark 主题,请参阅 spark.components.RichEditableText.imeMode。
对于 Mobile 主题,它不受支持。
先创建文本控件时将显示提示文本。控件获得焦点时或控件的
对于文本控件,如果用户输入文本,但随后又将其删除,则控件失去焦点后,提示文本将重新显示。您还可以通过编程方式将文本控件的 text 属性设置为空字符串使提示文本重新显示。
您可以使用 CSS 更改提示文本的样式。如果控件具有提示文本且未处于禁用状态,
以下示例 CSS 更改了作为 SkinnableTextBase 子类的控件(包括 Spark TextInput 和 TextArea 控件)中的提示文本的颜色:
@namespace s "library://ns.adobe.com/flex/spark"; s|SkinnableTextBase:normalWithPrompt { color: #CCCCFF; }
支持的值在 flash.text.ReturnKeyLabel 中定义:
对于 Spark 主题,它不受支持。
有关 Spark 主题,请参阅 spark.components.RichEditableText.selectable。
对于 Mobile 主题,请参阅 spark.components.supportClasses.StyleableStageText.selectable
有关 Spark 主题,请参阅 spark.components.RichEditableText.selectionActivePosition。
对于 Mobile 主题,请参阅 spark.components.supportClasses.StyleableStageText.selectionActivePosition
有关 Spark 主题,请参阅 spark.components.RichEditableText.selectionAnchorPosition。
对于 Mobile 主题,请参阅 spark.components.supportClasses.StyleableStageText.selectionAnchorPosition
有关 Spark 主题,请参阅 spark.components.RichEditableText.selectionHighlighting。
对于 Mobile 主题,它不受支持。
支持的值在 flash.text.SoftKeyboardType 中定义:
对于 Spark 主题,它不受支持。
有关 Spark 主题,请参阅 spark.components.RichEditableText.text。
对于 Mobile 主题,请参阅 spark.components.supportClasses.StyleableStageText#text
有关 Spark 主题,请参阅 park.components.RichEditableText.typicalText。
对于 Mobile 主题,它不受支持。