Flash AS3 Tutorials Center | Interesting Flash Animation Tutorials | Valuing Flash Animation Tutorials | Flash ActionScript and Animation Home

AS3 Beginner Tutorials | AS3 Basic Lessons | AS3 Valuing Courses | AS3 Components Tutorials | AS3 and PHP Interaction Tutorials
AS3 Practical Tutorials | AS3 Animation Techniques | AS3 Transition Effects Tutorials | AS3 Download Upload Files | AS3 Particle Systems
Communication Between Flash Movies with AS3 | AS3 and JavaScript interaction | AS3 Matrix Transformation | AS3 Physics Simulation Tutorials

Transition Effect with Tween Animation Flash ActionScript Tutorial (2)

This Flash Transition Effect tutorial has the same effect as the previous tutorial except that the island and sea picture is an external file. The picture will be loaded into the Flash Movie by ActionScript.

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

In previous Flash Transition Effect tutorial, the landscape was inserted into the Flash Movie. However some people would like to use the picture as external file. In other words, the picture will be loaded into the Flash Movie by ActionScript. This Flash Transition Effect tutorial will show how to do that.

The finished Flash Movie of this tutorial is shown as above. The transition effect of the landscape was created with TransitionManager. While the sun motion was created with Tween animation.

Flash ActionScript Codes:

//Classes to use the Transition Effect
import fl.transitions.*;
import fl.transitions.easing.*;

//Create a Timer object and store it in a variable called timer.
//The timer will trigger in 3000 milliseconds (3 seconds)
//1000 milliseconds = 1 second
//The repeatCount is 1, i.e. timer will trigger only ONE time
//Summary:
//Create a Timer instance that will trigger in 4 seconds for one time
var timer:Timer = new Timer(4000, 1);

//Timer object created will not start automatically
//You have to start it
timer.start();

//Add an event listener to the timer object (timer)
//The event that listen is called TIMER that will trigger after 4 seconds
//When the TIMER event is triggered, it will call the sunrise function
timer.addEventListener(TimerEvent.TIMER, sunrise);

 

function sunrise(e:TimerEvent):void{

//Apply Tween animation to the sun
var TweenX:Tween = new Tween(sun_mc, "x", Regular.easeOut, sun_mc.x, 200, 5, true);
var TweenY:Tween = new Tween(sun_mc, "y", Regular.easeOut, sun_mc.y, 210, 5, true);

//Remove listener that no longer in use
timer.removeEventListener(TimerEvent.TIMER, sunrise);

}

 


//URL of the external image content
var myRequest:URLRequest=new URLRequest("island.png");

//Create a new Loader to load the image
var loader:Loader = new Loader()

//Load the external image into the Loader
loader.load(myRequest)

// Listen when the loading of image is completed
loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadTheImage);

 

function loadTheImage(evt:Event):void {

//Display the Loader on the MainTimeline
//The holder_mc (new symbol) was created before by
//Insert -> New Symbol
holder_mc.addChild(loader)

//Start the TransitionManager
TransitionManager.start(holder_mc, {
type: PixelDissolve,
direction: Transition.IN,
duration: 3,
easing: None.easeNone,
xSections: 20,
ySections: 20
}
);

}

Download Flash Source File:

Flash Source File transitionmanager-animation-2.fla

Remarks:

This Flash ActionScript tutorial shows how to use Transition Effect with Tween animation class together.