Loading External Images in Flash
This tutorial will teach you how to load external images in Flash using the loadMovie
actionscript function. The .fla free download
file with the actionscript code is included at the end of the tutorial. Flash 8.0 must be installed in your system to download the
The concept for loading external images in Flash is to create an empty movie clip which will load the external image through the loadMovie actionscript function.
Steps to Follow :
1. Create a folder which will have your .fla file, .swf file and your external image. Name the external image photo.jpg.
2. Create the photo and empty movie clips
- Create an empty movie clip by clicking on Insert/New Symbol. Save the symbol as empty_mc.
- Create another movie clip and save it as photo_mc. This movie clip is for any properties you would like to add to the photo, like a frame around the photo or background color etc.
- Create a frame or background in this movie clip and drop the empty movie clip (empty_mc) inside the frame.
- Give an instance name to the empty movie clip, call it empty. The external image will be loaded into this empty movie clip.
- You should have photo_mc movie clip in the the main timeline, give this an instance name of photo.
3. Actionscript for loading the external image in the photo movie clip.
- Create a new layer in your main timeline for adding the actionscript for loading the external image.
- Choose the first frame in the actionscript layer and copy the following actionscript in the actionscript panel
This script loads the image photo.jpg which is saved externally in the same folder to the empty movie clip which is in the photo movie clip (instance names empty and photo).
- The script can also be added to the photo movie clip timeline if you don't want to add it to the main timeline frame. You just need to change the actionscript to
The above script can be added in the photo_mc timeline
Press Ctrl+Enter to test the file.
Congratulations! You have successfully learnt how to load external images in Flash using simple actionscript.
If the image is not loading, please check that the photo is saved as photo.jpg in the same folder and the instance names for the movie clips are correct.
Download the zip
Please note: You need Flash 8.0 to open the .fla file.
No portion of these materials may be reproduced in any manner whatsoever, without the express written consent of Entheos. Any unauthorized use, sharing, reproduction or distribution of these materials by any means, electronic, mechanical, or otherwise is strictly prohibited.