Graphing Calc Interactive Scientific Calc
 Graphing Calc Interactive Scientific Calc

# How to duplicate a movie clip and create a pattern

## This flash tutorial willl lead you through how to create several copies of a movie clip by using a loop

Part I: Create and name the movie clpi
• Step 1) Make a movie clip and place it on the stage. My example uses a red triangle with a gradient fill.

Step 2) Use the property inspector (Ctrl + F3) to give the movie clip an instance name. I will call my movie clip myClip_mc

At this point, we are ready to add the actionscript code that will duplicate our movie clip and create a pattern
• Step 1) Open the Actions Pane (F9)
• Step 2) Let's make a single copy of our movie clip. At this point we have successfully duplicated our movie clip and placed it at depth 2
• Step 3) You may have noticed that our duplicated movie clip is not very interesting right now. Let's move the x and y coordinates. Note: this example uses Actionscript 2.0 syntax (If you are using Actionscript 3 remember that ._x must be changed to .x and ._y must be changed to .y. Unlike Actionscript 2, Actionscript 3 does not prefix properties with an undersccore symbol ( _) .
• When you publish your file your screen should have two different movie clips on it
Part III. Using a Loop to duplicate the movie clips
• 1) In order to create several copies of a movie clip you can use a loop along with duplicate movie clip method. There are many different patterns that you could create. The pattern below causes the triangle to fade to nothing.

• ``` The actual actionscript code:
myClip_mc.duplicateMovieClip('copyClip',2);
copyClip._x =4;
copyClip._y =5;
for(i = 0;i< 20; i++)
{
myClip_mc.duplicateMovieClip('copyClip'+i,2+i);
_root['copyClip'+i]._x = 8*i;
_root['copyClip'+i]._y = 3*i;
_root['copyClip'+i]._alpha = 100-8*i;
}

```