We covered how to create a movie clip manually back in Chapter 5, "Symbols and the Library," but we will review it quickly here.
Creating Movie Clips Manually
To create a Movie Clip symbol manually, follow these steps:
That was pretty simple; you just created a movie clip manually. Now if you want to use it, drag an instance of it from the library onto the stage and give it an instance name.
Although technically you do not need to give every instance of a movie clip object an instance name unless you plan to refer to it with ActionScript, it is good practice to do so. Also remember that you cannot duplicate instance names in the same timeline or errors will occur.
Creating movie clips manually is not the only way to create them. You can also create them on-the-fly with ActionScript.
Creating Movie Clips with ActionScript
Since the MX version of Flash, users have been able to create movie clips with ActionScript. Before then, when you wanted an empty movie clip on the stage, you would have to create one manually, drag it onto the stage, and then give it an instance name.
To create empty movie clips in ActionScript, use the createEmptyMovieClip() method, which looks like this:
The parameters of this method are as follows:
That is the basic layout of the createEmptyMovieClip() method. The next example shows how to implement it.
When you're in the test movie screen, choose Debug, List Objects, and you should see in the Output panel something similar to Figure 13.1.
Figure 13.1. Using the List Objects option under Debug, you can see the movie clip you created via ActionScript.
The movie is listed in the Output panel.
Now that you have seen the different ways to create movie clips, continue on to see how to manipulate them.