Linked Images in Flash: How-to for the Non-Programmer
So, you designed some totally sweet Flash movie and then the client says, “but I want to be able to switch out those images whenever I feel like it.” Do you:
- throw a freakin’ hissy a la Naomi Campbell
- give up and watch some more YouTube
- put on your big girl panties and figure out how to do it
While all of those are perfectly viable options, I’ll focus on #3.
Go ahead and design your Flash movie with imported, embedded pictures. You’ll eventually be deleting the embedded pictures because you won’t need them, but when images are linked Flash will only show you a hole. Thus, you’ll need these temporarily embedded pictures to allow you to see what you’re doing.
Once you’ve got the movie looking the way you want it to, it’s time to start replacing the embedded pictures with linked ones. Go to the FRAME that contains the first picture you want to make linked rather than embedded. Write down the coordinates of the embedded picture, just in case you need to tweak the position of the linked picture. In the “actions” panel for the FRAME, enter:
Beware: the loadMovie bit is case-sensitive. You can now take a deep breath and delete the embedded picture. You won’t be able to see the linked picture from the stage, but if you test the movie (ctrl + enter), you should be able to see the picture, as long as you’ve typed in the picture’s location correctly and actually uploaded the picture (duh).
“But Amy,” you say, “this picture is SO not in the right position.”
Remember those coordinates you wrote down? In the actions panel, right under the line that contains the loadMovie action, enter:
this._x = "whatever your x coordinate is";
this._y = "whatever your y coordinate is";
The coordinates may require some additional small tweaks, but the linked image should be pretty close to where you need it by now.
- Any crazy effects or masking you decide to use may cause your images to flicker when they hit a tween point. You can be crafty and find ways around this, but I thought I’d warn you before you got too fancy.
- If your images are jpegs, make them non-progressive. Sometimes progressive images just won’t show up for some reason.
- You may need to set up the images as movie clips that contain ONLY the actions to retrieve and position the picture. For example, if you had a movie clip called guy_jumping which somewhere contained a picture that was linked, you may have to make a new movie clip called “guy_pic” and put THAT within “guy_jumping” rather than just inserting the loadMovie action onto some frame in guy_jumping. Other wise, the linked picture could load in some crazy, unintended place.