Zooming image effect using the AS3

24.9.2009, 16:4
Submited in: Flash | Total Views: 13477

Using this thoroughly explained, detailed flash lesson, I will explain to you how to create zooming image effect using the action script 3. You can use this effect for some flash banner, or for some other flash components. Using this lesson, you will also learn how to import any image into a flash stage, how to convert it into a Movie Clip Symbol, how to create instance name and much more. Let's start!


Move your mouse cursor over the image!

Step 1

First, find any image which you like to use for this lesson.

Step 2

Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the dimensions of your document as the dimensions of photo. Select any color as background color. Set your Flash movie's frame rate to 28 and click ok.

Step 3

Call the current layer image. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!

Step 4

Choose now File > Import > Import to stage (Ctrl+R) and import any image into a flash stage. While the image is still selected, go to the Align Panel (Ctrl+K) and do the following:

1. Make sure that the Align/Distribute to Stage button is turned on,
2. Click on the Align horizontal center button and
3. Click the Align vertical center button.

Step 5

While the image is still selected, hit F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol.

Step 6

While the new made movie clip is still selected, go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Movie Clip image_mc. See the picture below!

Step 7

Create a new layer above the layer image and name it AS. After that, select the first frame of layer AS, go to the action script panel (F9) and enter this code inside the actions panel:

import fl.transitions.*;
import fl.transitions.easing.*;

var transitions:Array = new Array();

image_mc.addEventListener (MouseEvent.MOUSE_OVER, mouseOverImage);
image_mc.transition = Zoom;

function mouseOverImage (e:Event):void {
 var selectedImage:MovieClip = MovieClip(;
 selectedImage.removeEventListener (MouseEvent.MOUSE_OVER, mouseOverImage);

 var myTransitionManager:TransitionManager = new TransitionManager(selectedImage);
 myTransitionManager.startTransition ({type:selectedImage.transition,
  direction:Transition.IN, duration:1, easing:Regular.easeOut, shape:Iris.CIRCLE});

 myTransitionManager.addEventListener ("allTransitionsInDone", animationComplete);

function animationComplete (e:Event):void { (MouseEvent.MOUSE_OVER, mouseOverImage);

We're done now!

Test your movie and enjoy!

Download example

Are you a website owner?
Click here to register and submit your tutorials!

Browse by category

Most popular tutorials