PDA

View Full Version : duplicating movie clipss???


viotti
01-17-2002, 08:17 PM
I'm working on a small project here that I could really use some help with. I'm a little overwhelmed with all this actionscript, so I'm probably just missing something little in the tutorials.

I have a main stage that I want 6 different images to fade in. From there I want to be able to click on each of the images and open another swf unto the main stage and make the rest of images to fade out.

I want to create a MC and duplicate it for the rest of the five images. The only difference between the movie clips would be the image itself. From what I've been reading, I assume that when I duplicate the MC I can position it anywhere on the mainstage so I should be able to get that part done without problems.

Can I just create a variable to hold the pictures and replace them when I duplicate the MC??

poab
01-18-2002, 01:55 AM
Hi,

One way to do it is to have seven keyframes inside your movieclip. Put a label on each frame and a 'stop();' action on each except the first. Labels should be something like blank, i, ii, iii, iiii, iiiii and iiiiii. Put each image on the relative frames (2-7).

Your first keyframe has nothing on it, except the following script:

var id = getProperty(this, _name);
gotoAndStop(""+id);

Now when you duplicateMovieClip you give the first instance the name i. The loop duplicating the clips can then ad an i to each clip. So the 3rd duplication would be called iii, internally to the clip it would then hop straight to the 3rd image (which is the fourth frame because the first frame is blank). That way you keep the script that determines the image internal to the clip and the code on the main timeline is less cluttered.

cheers.