Tutorials — How to use the loadMovie actionscript command

This tutorial will show you how to insert an external Flash movie (.swf) using the loadMovie actionscript command.


Add a New Symbol

First you will need to insert a new symbol to the Library. This will later act as a placeholder for where the external .swf file will be displayed on the stage.


The behavior should be Movie Clip and you can give it any name you like. In this example, we have chosen to name it slideshow which is the name that will appear in the Library window.


Add an instance to the stage

Open the Library window and drag your newly created symbol to the stage where you want the top,left corner of the loaded .swf movie to display at. You will only see a small circle on the stage as there is nothing in the symbol.


Name the instance

Once you placed the symbol on the stage, give that instance a name. In our example, we have chosen to name the instance slideshow.


Add the loadMovie command

You can now add the loadMovie command to the maintimeline.The first parameter is the name of the .swf file you want to load and display. The second parameter is the instance name where you want the movie to be loaded in to. The following code assumes the slideshow.swf file will be in the same folder as this swf file we are creating that loads in the slideshow.swf file.


When you run your movie, you should now see the slideshow.swf file displayed where you added the symbol.


You can download this example here