BETA ActionScript® 3.0 Reference for the Adobe® Flash® Platform
Home  |  Hide Packages and Classes List |  Packages  |  Classes  |  What's New  |  Index  |  Appendixes

Language Reference only
Filters: AIR 32.0 and earlier, Flash Player 32.0 and earlier, Flash Lite 4
None
Hide Filters
mx.effects 

Zoom  - AS3 Flex

(Preview)
Packagemx.effects
Classpublic class Zoom
InheritanceZoom Inheritance TweenEffect Inheritance Effect Inheritance EventDispatcher Inheritance Object

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1


Starting with Flex 4.0, Adobe recommends that you use the spark.effects.Scale class as an alternative to this class.

The Zoom effect zooms the object in or out on a center point.

When you apply a Zoom effect to text rendered using a system font, Flex scales the text between whole point sizes. While you do not have to use embedded fonts when you apply a Zoom effect to text, the Zoom will appear smoother when you apply it to embedded fonts.

Note: The Zoom effect does not work when the Container.autoLayout property is false.

MXML SyntaxexpandedHide MXML Syntax

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

View the examples

Related API Elements



Public Properties
 PropertyDefined By
  captureRollEvents : Boolean
If true, prevents Flex from dispatching the rollOut and rollOver events if the mouse has not moved.
Zoom
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  originX : Number
Number that represents the x-position of the zoom origin when the effect target is in a container that supports absolute positioning, such as the Canvas container.
Zoom
  originY : Number
Number that represents the y-position of the zoom origin when the effect target is in a container that supports absolute positioning, such as the Canvas container.
Zoom
  zoomHeightFrom : Number
Number that represents the scale at which to start the height zoom, as a percent between 0.01 and 1.0.
Zoom
  zoomHeightTo : Number
Number that represents the scale at which to complete the height zoom, as a percent between 0.01 and 1.0.
Zoom
  zoomWidthFrom : Number
Number that represents the scale at which to start the width zoom, as a percent between 0.01 and 1.0.
Zoom
  zoomWidthTo : Number
Number that represents the scale at which to complete the width zoom, as a percent between 0.01 and 1.0.
Zoom
Protected Properties
 PropertyDefined By
Public Methods
 MethodDefined By
  
Zoom(target:Object = null)
Constructor.
Zoom
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Protected Methods
 MethodDefined By
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
Property Detail
Constructor Detail
ZoomEffectExample.mxml
<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the Zoom effect. -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx: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);
                }
            }
        ]]>
    </fx:Script>

    <fx:Declarations>
        <mx:Zoom id="zoomAll" zoomWidthTo="1" zoomHeightTo="1" zoomWidthFrom=".5" zoomHeightFrom=".5"  />
    </fx:Declarations>

    <s:Panel title="Zoom Effect Example" width="95%" height="95%" >
        <s:VGroup left="20" right="20" top="20" bottom="20">

            <s:Label 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)"/>
        </s:VGroup>

    </s:Panel>
</s:Application>