Creating movie clips at runtime

In addition to creating movie clip instances in the Flash authoring environment, you can also create movie clip instances at runtime in the following ways:

Each movie clip instance you create at runtime must have an instance name and a depth (stacking, or z-order) value. The depth you specify determines how the new clip overlaps with other clips on the same timeline. It also lets you overwrite movie clips that reside at the same depth. (See Managing movie clip depths.)

For a sample source file, gallery_tween.fla, that provides an example of how to use ActionScript to control movie clips dynamically while loading image files into a SWF file, see the Flash Samples page at www.adobe.com/go/learn_fl_samples. Download and decompress the Samples zip file and navigate to the ActionScript2.0/Galleries folder to access the sample.

For a sample source file, animation.fla, that creates and removes numerous movie clips at runtime, see the Flash Samples page at www.adobe.com/go/learn_fl_samples. Download and decompress the Samples zip file and navigate to the ActionScript2.0/Animation folder to access the sample.

For more information, see the following topics: