| 包 | mx.effects |
| 类 | public class AddChildAction |
| 继承 | AddChildAction Effect EventDispatcher Object |
AddChild 属性的动画效果。您可以使用过渡定义中的 AddChildAction 效果控制过渡期间何时发生 AddChild 属性定义的视图状态更改。
MXML 语法
隐藏 MXML 语法The <mx:AddChildAction> tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:AddChildAction
Properties
id="ID"
index="-1"
relativeTo=""
position="index"
/>
另请参见
| 属性 | 定义方 | ||
|---|---|---|---|
![]() | className : String [只读 (read-only)] 效果类的名称,如“Fade”。 | Effect | |
![]() | constructor : Object
对类对象或给定对象实例的构造函数的引用。 | Object | |
![]() | customFilter : EffectTargetFilter 指定一个 EffectTargetFilter 类型的自定义滤镜对象,效果将使用此对象来确定播放效果的目标。 | Effect | |
![]() | effectTargetHost : IEffectTargetHost 一个属性,您可以通过设置此属性访问数据效果基于列表的目标控件。 | Effect | |
![]() | filter : String 指定用于过滤效果目标的算法。 | Effect | |
![]() | hideFocusRing : Boolean 确定在开始播放效果时,效果是否应隐藏对焦环。 | Effect | |
| index : int = -1 父项中子项的索引。 | AddChildAction | ||
![]() | instanceClass : Class 一个 Class 类型的对象,用于指定此效果类的效果实例类。 | Effect | |
![]() | isPlaying : Boolean [只读 (read-only)] 一个只读标志,如果当前正在播放效果的任一实例,则为 true;否则,则为 false。 | Effect | |
![]() | perElementOffset : Number 在效果的第一个目标之后,其它效果目标的附加延迟(以毫秒为单位)。 | Effect | |
| position : String = "index" 显示列表中子项的位置,随 relativeTo 属性指定的对象而变化。 | AddChildAction | ||
![]() | prototype : Object [静态]
对类或函数对象的原型对象的引用。 | Object | |
| relativeTo : DisplayObjectContainer 子组件的添加位置。 | AddChildAction | ||
![]() | relevantProperties : Array 一个属性名称 Array,执行过滤时将使用这些名称。 | Effect | |
![]() | relevantStyles : Array 一个样式名称 Array,执行过滤时将使用这些名称。 | Effect | |
![]() | repeatCount : int = 1 效果的重复次数。 | Effect | |
![]() | repeatDelay : int = 0 重复播放效果前需要等待的时间(以毫秒为单位)。 | Effect | |
![]() | startDelay : int = 0 开始播放效果前需要等待的时间(以毫秒为单位)。 | Effect | |
![]() | suspendBackgroundProcessing : Boolean = false 如果为 true,则在播放效果时阻止所有背景处理。 | Effect | |
![]() | target : Object 要应用此效果的 UIComponent 对象。 | Effect | |
![]() | targets : Array 一个 UIComponent 对象 Array,这些对象都是效果的目标。 | Effect | |
![]() | triggerEvent : Event 如果触发了某个效果,则此项目是由 EffectManager 传递给此 Effect 的 Event 对象;如果 EffectManager 当前没有播放此效果,则为 null。 | Effect | |
| 方法 | 定义方 | ||
|---|---|---|---|
AddChildAction(target:Object = null) 构造函数。 | AddChildAction | ||
![]() | addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void 使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。 | EventDispatcher | |
![]() | 捕获效果目标上相关属性的当前值,并将这些值另存为结束值。 | Effect | |
![]() | 捕获另一组目标相关属性的当前值。在运行数据更改效果时,此函数由 Flex 使用。 | Effect | |
![]() | 捕获效果目标上相关属性的当前值。 | Effect | |
![]() | 创建一个效果实例并对其进行初始化。 | Effect | |
![]() | 获取一个目标对象 Array,并对每个目标调用 createInstance() 方法。 | Effect | |
![]() | 删除实例中的事件侦听器,然后从实例列表中删除该实例。 | Effect | |
![]() | 将事件调度到事件流中。 | EventDispatcher | |
![]() | 中断当前正在播放的效果,立即跳转到该效果的末尾。 | Effect | |
![]() | 返回一个字符串 Array,其中每个 String 都是被此效果更改的属性名称。 | Effect | |
![]() | 检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。 | EventDispatcher | |
![]() |
指示对象是否已经定义了指定的属性。 | Object | |
![]() |
指示 Object 类的实例是否在指定为参数的对象的原型链中。 | Object | |
![]() | 暂停效果,直到调用 resume() 方法。 | Effect | |
![]() | 开始播放效果。 | Effect | |
![]() |
指示指定的属性是否存在、是否可枚举。 | Object | |
![]() | 从 EventDispatcher 对象中删除侦听器。 | EventDispatcher | |
![]() | 在效果由 pause() 方法暂停后继续播放效果。 | Effect | |
![]() | 逆序播放效果;如果当前正在播放效果,则从该效果的当前位置开始逆序播放。 | Effect | |
![]() |
设置循环操作动态属性的可用性。 | Object | |
![]() | 停止播放效果,使效果目标保持当前状态。 | Effect | |
![]() |
返回指定对象的字符串表示形式。 | Object | |
![]() |
返回指定对象的原始值。 | Object | |
![]() | 检查是否用此 EventDispatcher 对象或其任何始祖为指定事件类型注册了事件侦听器。 | EventDispatcher | |
| index | 属性 |
| position | 属性 |
public var position:String = "index"
显示列表中子项的位置,随 relativeTo 属性指定的对象而变化。有效值为 "before"、"after"、"firstChild"、"lastChild" 和 "index",其中 "index" 指定使用 index 属性确定子项的位置。
默认值为 "index".
| relativeTo | 属性 |
public var relativeTo:DisplayObjectContainer
子组件的添加位置。默认情况下,Flex 根据视图状态定义中的 AddChild 属性定义确定此值。
| AddChildAction | () | 构造函数 |
public function AddChildAction(target:Object = null)构造函数。
参数target:Object (default = null) — 要使用此效果为其设置动画的 Object。 |
<?xml version="1.0" ?>
<!-- Simple example to demonstrate the Transition class. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<!-- Define one view state, in addition to the base state.-->
<mx:states>
<mx:State name="Register">
<mx:AddChild relativeTo="{loginForm}" position="lastChild">
<mx:target>
<mx:FormItem id="confirm" label="Confirm:">
<mx:TextInput/>
</mx:FormItem>
</mx:target>
</mx:AddChild>
<mx:SetProperty target="{loginPanel}" name="title" value="Register"/>
<mx:SetProperty target="{loginButton}" name="label" value="Register"/>
<mx:SetStyle target="{loginButton}"
name="color" value="blue"/>
<mx:RemoveChild target="{registerLink}"/>
<mx:AddChild relativeTo="{spacer1}" position="before">
<mx:target>
<mx:LinkButton id="loginLink" label="Return to Login" click="currentState=''"/>
</mx:target>
</mx:AddChild>
</mx:State>
</mx:states>
<mx:transitions>
<!-- Define the transition from the base state to the Register state.-->
<mx:Transition id="toRegister" fromState="*" toState="Register">
<mx:Sequence targets="{[loginPanel, registerLink, confirm, loginLink, spacer1]}">
<mx:RemoveChildAction/>
<mx:SetPropertyAction target="{loginPanel}" name="title"/>
<mx:SetPropertyAction target="{loginButton}" name="label"/>
<mx:SetStyleAction target="{loginButton}" name="color"/>
<mx:Resize target="{loginPanel}"/>
<mx:AddChildAction/>
</mx:Sequence>
</mx:Transition>
<!-- Define the transition from the Register state to the base state.-->
<mx:Transition id="toDefault" fromState="Register" toState="*">
<mx:Sequence targets="{[loginPanel, registerLink,
confirm, loginLink, spacer1]}">
<mx:RemoveChildAction/>
<mx:SetPropertyAction target="{loginPanel}" name="title"/>
<mx:SetPropertyAction target="{loginButton}" name="label"/>
<mx:SetStyleAction target="{loginButton}" name="color"/>
<mx:Resize target="{loginPanel}"/>
<mx:AddChildAction/>
</mx:Sequence>
</mx:Transition>
</mx:transitions>
<!-- Define a Panel container that defines the login form.-->
<mx:Panel title="Login" id="loginPanel"
horizontalScrollPolicy="off" verticalScrollPolicy="off"
paddingTop="10" paddingLeft="10" paddingRight="10" paddingBottom="10">
<mx:Text width="100%" color="blue"
text="Click the 'Need to Register?' link to change state. Click the 'Return to Login' link to return to the base state."/>
<mx:Form id="loginForm" >
<mx:FormItem label="Username:">
<mx:TextInput/>
</mx:FormItem>
<mx:FormItem label="Password:">
<mx:TextInput/>
</mx:FormItem>
</mx:Form>
<mx:ControlBar>
<mx:LinkButton id="registerLink" label="Need to Register?"
click="currentState='Register'"/>
<mx:Spacer width="100%" id="spacer1"/>
<mx:Button label="Login" id="loginButton"/>
</mx:ControlBar>
</mx:Panel>
</mx:Application>