mx.effects
public class Zoom
继承Zoom Inheritance TweenEffect Inheritance Effect Inheritance EventDispatcher Inheritance Object

Zoom 效果放大或缩小中心点上的对象。

将 Zoom 效果应用到使用系统字体呈现的文本时,Flex 缩放整个磅值之间的文本。尽管将 Zoom 效果应用到文本时不必使用嵌入的字体,但将 Zoom 效果应用到嵌入的字体时,它将更加平滑。

注意:Container.autoLayout 属性为 false 时,Zoom 效果不起作用。

MXML 语法expanded隐藏 MXML 语法

The <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"
  />
  

查看示例

另请参见

mx.effects.effectClasses.ZoomInstance
mx.managers.LayoutManager


公共属性
 属性定义方
  captureRollEvents : Boolean
如果为 true,将阻止 Flex 在鼠标未发生过移动的情况下调度 rollOut 和 rollOver 事件。
Zoom
 InheritedclassName : String
[只读 (read-only)] 效果类的名称,如“Fade”。
Effect
 Inheritedconstructor : Object
对类对象或给定对象实例的构造函数的引用。
Object
 InheritedcustomFilter : EffectTargetFilter
指定一个 EffectTargetFilter 类型的自定义滤镜对象,效果将使用此对象来确定播放效果的目标。
Effect
 Inheritedduration : Number
效果的持续时间(以毫秒为单位)。
Effect
 InheritedeasingFunction : Function = null
动画的缓动函数。
TweenEffect
 InheritedeffectTargetHost : IEffectTargetHost
一个属性,您可以通过设置此属性访问数据效果基于列表的目标控件。
Effect
 Inheritedfilter : String
指定用于过滤效果目标的算法。
Effect
 InheritedhideFocusRing : Boolean
确定在开始播放效果时,效果是否应隐藏对焦环。
Effect
 InheritedinstanceClass : Class
一个 Class 类型的对象,用于指定此效果类的效果实例类。
Effect
 InheritedisPlaying : Boolean
[只读 (read-only)] 一个只读标志,如果当前正在播放效果的任一实例,则为 true;否则,则为 false。
Effect
  originX : Number
代表当效果目标位于支持绝对定位的容器(如 Canvas 容器)中时缩放原点 x 位置的数字。
Zoom
  originY : Number
代表当效果目标位于支持绝对定位的容器(如 Canvas 容器)中时缩放原点 y 位置的数字。
Zoom
 InheritedperElementOffset : Number
在效果的第一个目标之后,其它效果目标的附加延迟(以毫秒为单位)。
Effect
 Inheritedprototype : Object
[静态] 对类或函数对象的原型对象的引用。
Object
 InheritedrelevantProperties : Array
一个属性名称 Array,执行过滤时将使用这些名称。
Effect
 InheritedrelevantStyles : Array
一个样式名称 Array,执行过滤时将使用这些名称。
Effect
 InheritedrepeatCount : int = 1
效果的重复次数。
Effect
 InheritedrepeatDelay : int = 0
重复播放效果前需要等待的时间(以毫秒为单位)。
Effect
 InheritedstartDelay : int = 0
开始播放效果前需要等待的时间(以毫秒为单位)。
Effect
 InheritedsuspendBackgroundProcessing : Boolean = false
如果为 true,则在播放效果时阻止所有背景处理。
Effect
 Inheritedtarget : Object
要应用此效果的 UIComponent 对象。
Effect
 Inheritedtargets : Array
一个 UIComponent 对象 Array,这些对象都是效果的目标。
Effect
 InheritedtriggerEvent : Event
如果触发了某个效果,则此项目是由 EffectManager 传递给此 Effect 的 Event 对象;如果 EffectManager 当前没有播放此效果,则为 null。
Effect
  zoomHeightFrom : Number
一个介于 0.01 和 1.0 之间的百分比数值,代表开始进行高度缩放时的缩放比例。
Zoom
  zoomHeightTo : Number
一个介于 0.01 和 1.0 之间的百分比数值,代表完成高度缩放时的缩放比例。
Zoom
  zoomWidthFrom : Number
一个介于 0.01 和 1.0 之间的百分比数值,代表开始进行宽度缩放时的缩放比例。
Zoom
  zoomWidthTo : Number
一个介于 0.01 和 1.0 之间的百分比数值,代表完成宽度缩放时的缩放比例。
Zoom
受保护的属性
 属性定义方
 InheritedendValuesCaptured : Boolean = false
一个标志,如果已确定效果的结束值,则该标志中包含 true;如果需要在效果运行时从效果目标的当前属性捕获这些值,则其中包含 false。
Effect
公共方法
 方法定义方
  
Zoom(target:Object = null)
构造函数。
Zoom
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
使用 EventDispatcher 对象注册事件侦听器对象,以使侦听器能够接收事件通知。
EventDispatcher
 Inherited
捕获效果目标上相关属性的当前值,并将这些值另存为结束值。
Effect
 Inherited
捕获另一组目标相关属性的当前值。在运行数据更改效果时,此函数由 Flex 使用。
Effect
 Inherited
捕获效果目标上相关属性的当前值。
Effect
 Inherited
创建一个效果实例并对其进行初始化。
Effect
 Inherited
createInstances(targets:Array = null):Array
获取一个目标对象 Array,并对每个目标调用 createInstance() 方法。
Effect
 Inherited
删除实例中的事件侦听器,然后从实例列表中删除该实例。
Effect
 Inherited
将事件调度到事件流中。
EventDispatcher
 Inherited
end(effectInstance:IEffectInstance = null):void
中断当前正在播放的效果,立即跳转到该效果的末尾。
Effect
 Inherited
返回一个字符串 Array,其中每个 String 都是被此效果更改的属性名称。
Effect
 Inherited
检查 EventDispatcher 对象是否为特定事件类型注册了任何侦听器。
EventDispatcher
 Inherited
指示对象是否已经定义了指定的属性。
Object
 Inherited
指示 Object 类的实例是否在指定为参数的对象的原型链中。
Object
 Inherited
暂停效果,直到调用 resume() 方法。
Effect
 Inherited
play(targets:Array = null, playReversedFromEnd:Boolean = false):Array
开始播放效果。
Effect
 Inherited
指示指定的属性是否存在、是否可枚举。
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
从 EventDispatcher 对象中删除侦听器。
EventDispatcher
 Inherited
在效果由 pause() 方法暂停后继续播放效果。
Effect
 Inherited
逆序播放效果;如果当前正在播放效果,则从该效果的当前位置开始逆序播放。
Effect
 Inherited
设置循环操作动态属性的可用性。
Object
 Inherited
停止播放效果,使效果目标保持当前状态。
Effect
 Inherited
返回指定对象的字符串表示形式。
Object
 Inherited
返回指定对象的原始值。
Object
 Inherited
检查是否用此 EventDispatcher 对象或其任何始祖为指定事件类型注册了事件侦听器。
EventDispatcher
受保护的方法
 方法定义方
 Inherited
applyValueToTarget(target:Object, property:String, value:*, props:Object):void
供 Effect 基础结构内部使用。
Effect
 Inherited
当效果实例完成播放时调用。
Effect
 Inherited
当效果实例开始播放时调用此方法。
Effect
 Inherited
filterInstance(propChanges:Array, target:Object):Boolean
确定筛选效果实例所用的逻辑。
Effect
 Inherited
getValueFromTarget(target:Object, property:String):*
由 captureStartValues() 方法调用,用来从目标获得某个属性的值。
Effect
 Inherited
将效果的属性复制到效果实例。
Effect
 Inherited
当 TweenEffect 调度 TweenEvent 时调用此方法。
TweenEffect
事件
 事件 摘要 定义方
 Inherited[广播事件] Flash Player 或 AIR 应用程序获得操作系统焦点并变为活动状态时将调度此事件。EventDispatcher
 Inherited[广播事件] Flash Player 或 AIR 应用程序失去操作系统焦点并变为非活动状态时将调度此事件。EventDispatcher
 Inherited当效果完成播放时(既可以是效果实际完成播放时,也可以是通过调用 end() 方法中断效果时)调度。Effect
 Inherited当效果开始播放时调度。Effect
 Inherited当补间效果结束时调度。TweenEffect
 Inherited当开始播放补间效果时调度此事件,相当于首次调用 onTweenUpdate() 方法。TweenEffect
 Inherited每当补间效果更新目标时调度。TweenEffect
属性详细信息
captureRollEvents属性
public var captureRollEvents:Boolean

如果为 true,将阻止 Flex 在鼠标未发生过移动的情况下调度 rollOutrollOver 事件。使用 Zoom 效果在较大大小和较小大小之间切换效果目标时,将此属性设置为 true

例如,可使用 rollOverEffect 触发 Zoom 效果来缩小目标。目标收缩后,鼠标指针将不再位于目标上方,随之触发 rollOut 事件和相应的 rollOutEffect。通过将 captureRollEvents 属性设置为 true,可以防止 Flex 调度 rollOut 事件,除非因移动鼠标发生此事件。

默认值为 false.

originX属性 
public var originX:Number

代表当效果目标位于支持绝对定位的容器(如 Canvas 容器)中时缩放原点 x 位置的数字。缩放原点是目标上作为 Zoom 效果中心的位置。

此值必须介于 0 和目标组件的宽度之间。

默认值为 target.width / 2,这是目标的中心。

originY属性 
public var originY:Number

代表当效果目标位于支持绝对定位的容器(如 Canvas 容器)中时缩放原点 y 位置的数字。缩放原点是目标上作为 Zoom 效果中心的位置。

此值必须介于 0 和目标组件的高度之间。

默认值为 target.height / 2,此位置是目标的中心。

zoomHeightFrom属性 
public var zoomHeightFrom:Number

一个介于 0.01 和 1.0 之间的百分比数值,代表开始进行高度缩放时的缩放比例。默认值为 0.01,此时显示的高度非常小。

zoomHeightTo属性 
public var zoomHeightTo:Number

一个介于 0.01 和 1.0 之间的百分比数值,代表完成高度缩放时的缩放比例。默认值为 1.0,此时对象显示为正常高度。

zoomWidthFrom属性 
public var zoomWidthFrom:Number

一个介于 0.01 和 1.0 之间的百分比数值,代表开始进行宽度缩放时的缩放比例。默认值为 0.01,此时显示的宽度非常小。

zoomWidthTo属性 
public var zoomWidthTo:Number

一个介于 0.01 和 1.0 之间的百分比数值,代表完成宽度缩放时的缩放比例。默认值为 1.0,此时对象显示为正常宽度。

构造函数详细信息
Zoom()构造函数
public function Zoom(target:Object = null)

构造函数。

参数
target:Object (default = null) — 要使用此效果为其设置动画的 Object。
示例 如何使用示例
ZoomEffectExample.mxml
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the Zoom effect. -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">

    <mx:Script>
        <![CDATA[        
            import flash.events.MouseEvent;
        
            public function doZoom(event:MouseEvent):void {
                if (zoomAll.isPlaying) {
                    zoomAll.reverse();
                }
                else {
                    // If this is a ROLL_OUT event, play the effect backwards. 
                    // If this is a ROLL_OVER event, play the effect forwards.
                    zoomAll.play([event.target], event.type == MouseEvent.ROLL_OUT ? true : false);
                }
            }
        ]]>    
    </mx:Script>

    <mx:Zoom id="zoomAll" zoomWidthTo="1" zoomHeightTo="1" zoomWidthFrom=".5" zoomHeightFrom=".5"  />
    
    <mx:Panel title="Zoom Effect Example" width="95%" height="95%" horizontalAlign="center"
        paddingTop="5" paddingLeft="10" paddingRight="10" paddingBottom="5">

        <mx:Text width="100%" color="blue"
            text="Move the mouse over the image to enlarge it. Move the mouse off of the image to shrink it."/>

        <mx:Image id="img"
            source="@Embed(source='assets/Nokia_6630.png')"
            scaleX=".5" scaleY=".5"
            rollOver="doZoom(event)"
            rollOut="doZoom(event)"/>

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