Having photos in flash application is great and the process of creating one is not that difficult either. Basically there are two ways to have photos displayed in flash application. One way is to import the photos into flash file during authoring time and the other one is to load externally photos during flash run time. Today, I'm going to show you how to load photos on the fly during flash run time.
Here is what you are going to build today
To begin with, please download the partially done source code. It includes two photos and one incomplete flash file.
1. Open the incomplete flash file you downloaded earlier. You will see two buttons. When clicked you want to load the two external photos namely 'cambodia1.jpg' and 'cambodia2.jpg'.
2. Now, let's work on the flash actionscript part. First, click on first frame of Layer 1 and press F9 to open action panel and paste these flash actionscript codes inside.
| _root.createEmptyMovieClip("myPhotoClip",1);
myPhotoClip.createEmptyMovieClip("photoHolder",1); |
3. Click on first button and press F9 to open action panel if it's not already opened. Paste these codes inside.
| on(release) {
_root.myPhotoClip.photoHolder.loadMovie("cambodia1.jpg"); } |
4. Click on the other button and paste these flash actionscript codes inside the action panel.
| on(release) {
_root.myPhotoClip.photoHolder.loadMovie("cambodia2.jpg"); } |
5. You are ready to test the flash movie. Press Ctrl + Enter to test the movie.
And here is the full flash source code.




