User Guide
566 Chapter 7: ActionScript for Flash
box_mc.onRelease = function() {
this.clear();
};
drawBox(box_mc, 10, 10, 320, 240);
function drawBox(mc:MovieClip, x:Number, y:Number, w:Number, h:Number):Void {
mc.lineStyle(0);
mc.beginFill(0xEEEEEE);
mc.moveTo(x, y);
mc.lineTo(x+w, y);
mc.lineTo(x+w, y+h);
mc.lineTo(x, y+h);
mc.lineTo(x, y);
mc.endFill();
}
See also
MovieClip.lineStyle()
MovieClip.createEmptyMovieClip()
Availability
Flash Player 6.
Usage
my_mc.createEmptyMovieClip(instanceName:String, depth:Number) : MovieClip
Parameters
instanceName
A string that identifies the instance name of the new movie clip.
depth An integer that specifies the depth of the new movie clip.
Returns
A reference to the newly created movie clip.
Description
Method; 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.
Example
The following ActionScript creates a new movie clip at runtime and loads a JPEG image into the
movie clip.
this.createEmptyMovieClip("logo_mc", this.getNextHighestDepth());
logo_mc.loadMovie("http://www.macromedia.com/images/shared/product_boxes/
80x92/studio_flashpro.jpg");
See also
MovieClip.attachMovie()