MovieClip
833
Example
The following example creates a square with red fill on the Stage:
this.createEmptyMovieClip("square_mc", this.getNextHighestDepth());
square_mc.beginFill(0xFF0000);
square_mc.moveTo(10, 10);
square_mc.lineTo(100, 10);
square_mc.lineTo(100, 100);
square_mc.lineTo(10, 100);
square_mc.lineTo(10, 10);
square_mc.endFill();
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.
An example is also in the drawingapi.fla file in the Samples\ActionScript\DrawingAPI. The
following list gives typical paths to this folder:
■
Windows: \Program Files\Macromedia\Flash 8\Samples and Tutorials\Samples\
■
Macintosh: HD/Applications/Macromedia Flash 8/Samples and Tutorials/Samples/
See also
moveTo (MovieClip.moveTo method)
,
endFill (MovieClip.endFill method)
,
beginGradientFill (MovieClip.beginGradientFill method)
beginGradientFill (MovieClip.beginGradientFill
method)
public beginGradientFill(fillType:String, colors:Array, alphas:Array,
ratios:Array, matrix:Object, [spreadMethod:String],
[interpolationMethod:String], [focalPointRatio:Number]) : Void
Indicates the beginning of a new drawing path. If the first parameter is
undefined,
or if no
parameters are passed, the path has no fill. If an open path exists (that is if the current drawing
position does not equal the previous position specified in a
MovieClip.moveTo()
method),
and it has a fill associated with it, that path is closed with a line and then filled. This is similar
to what happens when you call
MovieClip.endFill()
.
This method fails if any of the following conditions exist:
■
The number of items in the
colors
,
alphas
, and
ratios
parameters are not equal.
■
The
fillType
parameter is not
"linear"
or
"radial"
.
■
Any of the fields in the object for the
matrix
parameter are missing or invalid.
You can extend the methods and event handlers of the MovieClip class by creating a subclass.
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...