Movieclip.clear() - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

MovieClip.clear()

Availability
Flash Player 6.
Usage
my_mc.clear() : Void
Parameters
None.
Returns
Nothing.
Description
Method; removes all the graphics created during runtime using the movie clip draw methods,
including line styles specified with
drawn during authoring time (with the Flash drawing tools) are unaffected.
Example
The following example draws a box on the Stage. When the user clicks the box graphic, it removes
the graphic from the Stage.
this.createEmptyMovieClip("box_mc", this.getNextHighestDepth());
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();
}
An example is also in the drawingapi.fla file in the HelpExamples folder. The following list gives
typical paths to this folder:
Windows: \Program Files\Macromedia\Flash MX 2004\Samples\HelpExamples\
Macintosh: HD/Applications/Macromedia Flash MX 2004/Samples/HelpExamples/
See also
MovieClip.lineStyle()
MovieClip.lineStyle()
. Shapes and lines that are manually
MovieClip.clear()
503

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flash mx

Table of Contents