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 ActionScript 3 Tutorial: Load External Flash swf One by One Continuously

In previous Flash tutorials, the external swf files are loaded into the stage when the Flash Movie is loaded or when a button is clicked. In this tutorial, the external swf files are loaded into the Flash Movie one by one continuously.

Please update flash player to view this Flash ActionScript tutorial!

Flash Tutorial Content:

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

This flash animation effect is more easily be achieved by writing the ActionScript code in the timeline.

flash actionscript 3 load external swf

The idea of this Flash ActionScript is basically involves two steps.

Step 1: Load External swf File 1

When the Flash Movie loads up, the external swf file 1 is loaded into the Flash Movie using the same technique we used before. The Flash Actionscript codes are written in frame 1.

Flash ActionScript Codes:

var imageLoaded:Boolean = false;

 

// Create a new Loader to load the swf files
var myLoader:Loader=new Loader();

 

// Set the location of the new Loader
myLoader.x=220;
myLoader.y=150;

 

// function to load the Flash Movie 1 "glow.swf"

function loadMovie1(evt:Event):void {

var myRequest:URLRequest=new URLRequest("glow.swf");
myLoader.load(myRequest);
addChild(myLoader);
// Set imageLoaded to true so that the Image can be unloaded
imageLoaded = true;

}

 

// load external swf when Flash Movie load
loadMovie1(null);

Step 2: Remove swf File 1

Remove the external swf file 1 after it is loaded and displayed for a certain time. The Flash Actionscript codes are written in frame 30. Therefore the time to display the swf file 1 can easily be adjusted by the frame written the ActionScript.

function removeMovie(evt:Event):void{
if (imageLoaded == true) {
myLoader.unload();
removeChild(myLoader);
// Set imageLoaded to false to prevent error when no Image loaded
imageLoaded = false;
}

}

removeMovie(null);

Repeat the above steps to load more external swf files.

Download Flash Source File:

Flash Source File load-swf-7.fla

Remarks:

This Flash ActionScript tutorial shows how to load external Flash swf files one by one continuously.