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

Flash AS Tutorial: Load External Image to Empty MovieClip (1)

Actually many Flash designer also like to insert empty MovieClips on the MainTimeline and load the external images into the empty MovieClips with Flash ActionScript. This method allow you to control the layer or depth of images on Flash Movie much easier.

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

Sometimes you would like to control the layer or depth of the external image loaded into the Flash Movie. The most easiest way is to insert an empty MovieClip into the desired layer of Flash Movie. Then load the external image into the empty MovieClip. This Flash ActionScript tutorial will show you how to do it.

The complete Flash Movie is shown as above, you may try how it works before you start this tutorial.

Flash ActionScript Codes:

//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 -> Select MovieClip
Give this new symbol any name you like (e.g. MyImage)
Return to the scene.
Drag the MovieClip (e.g. MyImage) into your scene from the Library window
Give the instance name of this MovieClip "holder_mc"
*/
holder_mc.addChild(loader)


/*
You can add fun to the picture showing up, e.g. TransitionManager
Note:
Remember to add Classes to use the Transition Effect at the beginning
import fl.transitions.*;
import fl.transitions.easing.*;

Please see "Transition Effect + Tween Animation (2)"

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 load-image-4.fla

Remarks:

When the file size of the external images are very large. This may take some time to load the external image. Under this situation, you may consider to add a preloader that shows the progress or status of the loading otherwise the visitors do not know what happens. The next Flash ActionScript tutorial will show how to add a very simple preloader during the loading.