There is yet another way to get your images to display in Flash. When you add
a JPG to your library, you embed it into the SWF file when you publish it.
This can increase your main SWF file size and therefore cause the end user to
have to wait until the content has completely downloaded. If the image is
located in a part of the flash document that they may not even view, why would
you want to force them to load it until they needed to see it?
So, using the loadMovie() function in action script, you can tell flash to go
get an image from your website's image folder or local folder and display it on
the stage.
Create a new blank movie clip and call it myContainer (this is insignificant,
you can call it whatever you want.)
Open that clip for editing and create a rectangle within the clip. Adjust the
size of the rectangle to match the size of your photo, or not. Not terribly
important.
Close the clip and drag it to the main stage.
Give it an instance name in the properties panel. Call it myContainer_mc (or
whatever you want, making sure you have no spaces in the instance name)
Now, create a new layer in your main timeline and label it 'actions.'
Insert a keyframe in whichever frame you want the image to load during the
main timeline animation (try frame 1 to start). Make sure that you have this
frame selected, then...
Press F9 to open the action panel and type the following code...
myConatiner_mc.loadMovie("path to image.jpg");
The path to the image needs to be relative to your main flash swf file. For
instance, if your images are located in
www.yourdomain.com\images and your swf
file is located in
www.yourdomain.com, then the loadMovie code will look like
this:
myContainer_mc.loadMovie("images\yourimage.jpg");
If your SWF file is located in
www.yourdomain.com\flash\ and your images are
also one folder below the root of the site (
www.yourdomain.com\images\, you'd
need to type this:
myContainer_mc.loadMovie("..\images\yourimage.jpg");
The two dots returns flash to the root path before looking for the image
folder. If you don't put the two dots, you'd be telling flash to look for your
images in the
www.yourdomain.com\flash\images\ folder, which doesn't exist.
Close the action panel.
code translated: Flash, when you get to frame 1, load my image into the empty
movie clip on the stage which has the INSTANCE name myContainer_mc.
The cool thing about the instance name is that you can drag another copy of
the myContainer movie clip from the library to the stage on another layer in
the main timeline, give it another instance name like myContainer2_mc and then
change up your action script to load another image (or swf file) into that
INSTANCE of the myContainer movie clip, e.g.:
myContainer_mc.loadMovie("images\myfirstimage.jpg");
myContainer2_mc.loadMovie("images\mysecondimage.jpg");
The cool part about this is that you don't need to create multiple movie clips
to contain external images. You only need to give each instance of the same
movie clip a different name and prefix your action script with the instance
name to address that instance.
I hope this gave you insight to loading external images so you don't clog your
swiff with tons of unecessary images. This is not the only way to do this, as
I have been discovering. I believe there are 4 separate methods within action
scripting to load external resources. I may be mistaken.
I'm a total beginner by the way.