<mx:tagname Properties customFilter="" duration="500" filter="" hideFocusRing="false" perElementOffset="0" repeatCount="1" repeatDelay="0" startDelay="0" suspendBackgroundProcessing="false|true" target="effect target" targets="array of effect targets" Events effectEnd="No default" efectStart="No default" />]]>
在应用程序中不创建 Effect 类本身的实例,而是创建一个子类的实例,如 Fade 或 WipeLeft。
启动效果的过程通常分为三个步骤:
target[property] = value;
仅当需要以其他方式应用捕获的值时,才覆盖此方法。请注意,目标的样式属性将使用其他机制进行设置。使用
Flex 将从
创建自定义效果时覆盖此方法,将属性从 Effect 类复制到效果实例类。进行覆盖时,请调用
Effect 类的所有子类都必须在其构造函数中设置此属性。
大多数情况下,建议将此属性设置为
<mx:tagname createMaskFunction="" moveEasingFunction="" scaleEasingFunction="" scaleXFrom="" scaleXTo="" scaleYFrom="" scaleYTo="" show="true|false" xFrom="" xTo="" yFrom="" yTo="" />]]>
遮罩效果使用名为“遮罩”的叠加层来执行该效果。默认情况下,遮罩是一个矩形,与目标组件大小相同。
应用遮罩效果之前或之后,目标组件的状态必须是不可见的。也就是说,遮罩效果通常会使目标组件出现在屏幕上,或从屏幕中消失。
您可以使用
您可以使用
遮罩的初始位置和最终位置坐标取决于效果的类型以及
对于
如果某个效果只播放一次,则此事件将与
如果通过子类化 MaskEffect 类创建自定义效果,并且该子类修改目标上的其它属性集,则必须覆盖此方法,并返回一个包含被子类修改的属性列表的 Array。
自定义遮罩函数具有以下签名:
public function createLargeMask(targ:Object, bounds:Rectangle):Shape { var myMask:Shape = new FlexShape(); // Create mask. return myMask; }
自定义遮罩函数的一个参数对应于效果的目标组件,另一个参数用于定义目标尺寸,以便您正确设置遮罩大小。您可以使用此参数访问目标组件的
此函数将返回一个用于定义遮罩的 Shape 对象。
要指定此属性,您必须指定以下所有四个属性:
要指定此属性,您必须指定以下所有四个属性:
要指定此属性,您必须指定以下所有四个属性:
要指定此属性,您必须指定以下所有四个属性:
要指定此属性,您必须指定以下所有四个属性:
要指定此属性,您必须指定以下所有四个属性:
要指定此属性,您必须指定以下所有四个属性:
要指定此属性,您必须指定以下所有四个属性:
<mx:SoundEffect>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:SoundEffect Properties id="ID" autoLoad="true|false" bufferTime="1000" loops="0" panEasingFunction="" panFrom="0" source="" startTime="0" useDuration="true|false" volumeEasingFunction="true|false" volumeTo="1" Events complete="No default" id3="No default" ioError="No default" progress="No default" />]]>
可以使用
在事件对象内部,您可以访问当前已加载的字节数和要加载的总字节数。不保证一定会分派此事件,这意味着可能在未分派任何
<mx:TweenEffect>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:TagName Properties easingFunction="easing function name; no default" Events tweenEnd="No default" />]]>
通过创建 TweenEffect 类的子类可定义在某段时间内播放动画的效果。例如,Resize 效果会在指定的时段内修改其目标的大小。
如果只播放一次补间效果,则此事件将与
如果未指定缓动函数,则使用基于
该缓动函数位于 Robert Penner 编写的函数签名之后。该函数使用四个参数:第一个参数是“current time”,其中动画的开始时间是 0;第二个参数是动画开始时的初始值(一个 Number);第三个参数是结束值与初始值之间的差值;第四个参数是动画的持续时间。返回值是当前时间的插值。此值通常介于初始值和结束值之间。
此属性的值必须是一个函数对象。
Flex 在 mx.effects.easing 包中提供了一组缓动函数。
当定义补间效果时,通常在
在效果持续期间,Tween 对象将按固定的时间间隔对效果实例调用
当效果结束时,Tween 对象将调用
调用此构造函数后,动画将自动开始播放。
通过这种方法,您可以指定不同的方法作为更新回调函数和结束回调函数。
如果未指定缓动函数,则使用基于
该缓动函数位于 Robert Penner 编写的函数签名之后。该函数使用四个参数:第一个参数是“current time”,其中动画的开始时间是 0;第二个参数是动画开始时的初始值(一个 Number)。第三个参数是结束值与初始值之间的差值;第四个参数是动画的持续时间。返回值是当前时间的内插值(通常是介于初始值和结束值之间的值)。
Flex 在 mx.effects.easing 包中提供了一组缓动函数。
效果开发人员必须为其自定义效果创建实例类。
<mx:Zoom>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:Zoom id="ID" captureRollEvents="false|true" originX="Calculated" originY="Calculated" zoomWidthFrom="0.01" zoomWidthTo="1.0" zoomHeightFrom="0.01" zoomHeightTo="1.0" />]]>
将 Zoom 效果应用到使用系统字体呈示的文本时,Flex 缩放整个磅值之间的文本。尽管将 Zoom 效果应用到文本时不必使用嵌入的字体,但将 Zoom 效果应用到嵌入的字体时,它将更加平滑。
注意:当
例如,可使用
此值必须介于 0 和目标组件的宽度之间。
默认值为此值必须介于 0 和目标组件的高度之间。
默认值为<mx:AnimateProperty>
tag
inherits all the tag attributes of its superclass
and adds the following tag attributes:
<mx:AnimateProperty id="ID" fromValue="0" isStyle="false|true" property="required" roundValue="false|true" toValue="0" />]]>
例如,要更改 Button 控件的宽度,您可以指定
<mx:Move>
tag
inherits all of the tag attributes of its of its superclass,
and adds the following tag attributes:
<mx:Move id="ID" xFrom="val" yFrom="val" xTo="val" yTo="val" xBy="val" yBy="val" />]]>
如果指定值初始位置、目标位置或移动量这些值中的任意两个,则 Flex 会计算第三个值。如果指定所有这三个值,则 Flex 会忽略
如果指定
通常,您将此效果应用到使用绝对定位的容器(如 Canvas)或使用
<mx:Iris>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:Iris id="ID" />]]>
<mx:Sequence>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:Sequence id="identifier"> <mx:children> <!-- Specify child effect tags --> </mx:children> </mx:Sequence>]]>
您可以在 MXML 中创建 Sequence 效果,如下例所示:
<mx:Sequence id="WipeRightUp"> <mx:children> <mx:WipeRight duration="1000"/> <mx:WipeUp duration="1000"/> </mx:children> </mx:Sequence> <mx:VBox id="myBox" hideEffect="{WipeRightUp}"> <mx:TextArea id="aTextArea" text="hello"/> </mx:VBox>
请注意,
在 ActionScript 中启动 composite 效果通常分为五个步骤:
myFadeEffect = new mx.effects.Fade(target);
mySequenceEffect = new mx.effects.Sequence();
mySequenceEffect.addChild(myFadeEffect);
mySequenceEffect.play();
<mx:Dissolve>
tag
inherits the tag attributes of its superclass,
and adds the following tag attributes:
<mx:Dissolve id="ID" alphaFrom="val" alphaTo="val" color="val" />]]>
如果目标对象是一个 Container,则 Dissolve 效果将应用于容器内部的内容区域。内容区域指容器背景颜色可见的区域。
注意:要将 Dissolve 效果用于 DataGrid 控件的
如果效果导致目标组件消失,则默认值为目标的
如果效果导致目标组件消失,则默认值为 0.0。如果效果导致目标组件显示,则默认值为目标的
<mx:Blur>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:Blur id="ID" blurXFrom="val" blurXTo="val" blurYFrom="val" blurYTo="val" />]]>
Blur 效果将 Flash BlurFilter 类用作其实现的一部分。有关详细信息,请参见 flash.filters.BlurFilter。
如果对某个组件应用了 Blur 效果,则无法再对该组件应用 BlurFilter,也无法再次应用 Blur 效果。
如果此效果是数据更改效果的一部分,Flex 会自动调用
在运行数据更改效果时,Flex 将使用此函数。
如果希望效果指出此效果的起始值和结束值,请使用此函数。下面是使用此函数的正确步骤:
所创建的效果实例的类型由
调用
如果调用此方法来结束播放效果,效果实例将分派
如果将效果实例作为参数传递,则会中断此实例。如果没有传入参数,则该效果当前生成的所有效果实例都将中断。
Effect 的每个子类都必须实现此方法。EffectManager 使用此方法来避免试图同时对同一对象的相同属性设置两种不同的动画效果。
所有子类都必须实现此方法。
如果调用此方法来结束播放效果,效果实例将分派
对于遮罩效果,停止播放效果后不会自动删除遮罩。如果事先没有删除遮罩就继续对同一目标运行遮罩效果,可能会出现意外结果。
这是一个短类名称或 unqualified 类名称,不包含包名称。如果需要限定名称,可使用 flash.utils 包中的
只有在播放效果之前调用
使用
在 Parallel 或 Sequence 效果中,可通过
对于重复播放的效果来说,
只有在播放效果之前调用
使用此属性可实现简单过滤。使用
将此属性设置为
对于 Effect 的子类,默认值是
默认值为
默认值为
<mx:Pause>
tag
inherits all the tag attributes of its superclass,
and adds the following tag attributes:
<mx:Pause id="ID" eventName="null" />]]>
对
此属性是可选的;默认操作是播放而不等待任何事件。
<mx:tagname> <mx:children> <!-- Specify child effect tags --> </mx:children> </mx:tagname>]]>
您可以在 MXML 中创建复合效果,如以下示例所示:
<mx:Parallel id="WipeRightUp"> <mx:children> <mx:WipeRight duration="1000"/> <mx:WipeUp duration="1000"/> </mx:children> </mx:Parallel> <mx:VBox id="myBox" hideEffect="WipeRightUp"> <mx:TextArea id="aTextArea" text="hello"/> </mx:VBox>
在 ActionScript 中启动 composite 效果通常分为五个步骤:
myFadeEffect = new mx.effects.Fade(target);
mySequenceEffect = new mx.effects.Sequence();
mySequenceEffect.addChild(myFadeEffect);
mySequenceEffect.play();
此函数将作为数据更改效果的一部分由
<mx:SetStyleAction>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:SetStyleAction Properties id="ID" style="" value="" />]]>
如果创建此类的子类来创建自定义效果,则必须覆盖此方法并返回包含子类修改的样式属性列表的 Array。
<mx:Rotate>
tag
inherits all of the tag attributes of its superclass,
and adds the following tag attributes:
<mx:Rotate id="ID" angleFrom="0" angleTo="360" originX="0" originY="0" />]]>
注意:要对文本使用 Rotate 效果,必须使用嵌入字体,而不是设备字体。
如果
EffectTargetFilter 类定义使用
您还可以定义自定义滤镜函数来实现自己的过滤逻辑。为此,定义滤镜函数,然后使用
要配置效果以使用自定义滤镜,可将 EffectTargetFilter 对象传递到效果的
滤镜函数具有以下特征:
filterFunc(propChanges:Array, instanceTarget:Object):Boolean { // Return true to play the effect on instanceTarget, // or false to not play the effect. }
其中:
如果定义自定义滤镜函数,则您可以在自己的函数中检查
如果定义自定义滤镜函数,则您可以在自己的函数中检查
使用数据效果时,您可以使用此属性过滤效果。如果希望在不是由效果添加的 list 控件的所有目标(即以任何其它方式删除、替换、移动或影响的目标)上播放数据效果,您可以按如下方式写入效果定义:
<mx:Blur> <mx:customFilter> <mx:EffectTargetFilter requiredSemantics="{{'added':false}}"/> </mx:customFilter> </mx:Blur>
要在不是由效果添加或删除的所有目标上播放数据效果,您可以按如下方式写入效果定义:
<mx:Blur> <mx:customFilter> <mx:EffectTargetFilter requiredSemantics="{{'added':false}, {'removed':false}}"/> </mx:customFilter> </mx:Blur>
您可以指定的允许的属性列表包括
<mx:Fade>
tag
inherits the tag attributes of its superclass,
and adds the following tag attributes:
<mx:Fade id="ID" alphaFrom="val" alphaTo="val" />]]>
如果为
注意:要对文本使用淡入淡出效果,必须使用嵌入字体,而不是设备字体。
如果效果导致目标组件消失,则默认值为目标的
如果效果导致目标组件消失,则默认值为 0.0。如果效果导致目标组件显示,则默认值为目标的
<mx:Parallel id="identifier"> <mx:children> <!-- Specify child effect tags --> </mx:children> </mx:Parallel>]]>
可以在 MXML 中创建 Paralell 效果,如下例所示:
<mx:Parallel id="WipeRightUp"> <mx:children> <mx:WipeRight duration="1000"/> <mx:WipeUp duration="1000"/> </mx:children> </mx:Parallel> <mx:VBox id="myBox" hideEffect="{WipeRightUp}" > <mx:TextArea id="aTextArea" text="hello"/> </mx:VBox>
请注意,
在 ActionScript 中启动 Parallel 效果通常分为五个步骤:
myFadeEffect = new mx.effects.Fade(target);
myParallelEffect = new mx.effects.Parallel();
myParallelEffect.addChild(myFadeEffect);
myParallelEffect.play();
效果开发人员必须为其自定义效果创建实例类。
如果调用此方法来结束播放效果,效果实例将分派
在 EffectInstance 的子类中,您可以在进行覆盖时顺便覆盖此方法,并应在完成您的逻辑之后从覆盖的结束位置调用
您不必在子类中覆盖此方法。在使用效果时无需调用此方法,但在创建效果子类时可能需要调用此方法。
您不必在子类中覆盖此方法。您无需在使用效果时调用此方法。
在 EffectInstance 的子类中,必须覆盖此方法。此覆盖必须调用
如果调用此方法来结束播放效果,效果实例将分派
这是一个短类名称或“非限定”类名称,不包含包名称。如果需要限定名称,可使用 flash.utils 包中的
将此属性设置为
对于 Effect 的子类,默认值是
通常使用
如果通过调用