createEmptyMovieClip (MovieClip.createEmptyMovieClip method)

public createEmptyMovieClip(name:String, depth:Number) : MovieClip

Creates an empty movie clip as a child of an existing movie clip. This method behaves similarly to the attachMovie() method, but you don't need to provide an external linkage identifier for the new movie clip. The registration point for a newly created empty movie clip is the upper-left corner. This method fails if any of the parameters are missing.

You can extend the methods and event handlers of the MovieClip class by creating a subclass.

Availability: ActionScript 1.0; Flash Player 6

Parameters

name:String - A string that identifies the instance name of the new movie clip.

depth:Number - An integer that specifies the depth of the new movie clip.

Returns

MovieClip - A reference to the newly created movie clip.

Example

The following example creates an empty MovieClip named container, creates a new TextField inside of it, and then sets the new TextField.text property.

var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
var label:TextField = container.createTextField("label", 1, 0, 0, 150, 20);
label.text = "Hello World";

The MovieClip.getNextHighestDepth() method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components' DepthManager class instead of the MovieClip.getNextHighestDepth() method.

See also

attachMovie (MovieClip.attachMovie method)


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00001901.html