![]() ![]() ![]() | |
![]() | |
![]() | |
![]() |
You can use methods of the MovieClip class to draw lines and fills on the Stage. This allows you to create drawing tools for users and to draw shapes in the movie in response to events. The drawing methods are beginFill()
, beginGradientFill()
, clear()
, curveTo()
, endFill()
, lineTo()
, lineStyle()
, and moveTo()
.
You can use the drawing methods with any movie clip. However, if you use the drawing methods with a movie clip that was created in authoring mode, the drawing methods execute before the clip is drawn. In other words, content that is created in authoring mode is drawn on top of content drawn with the drawing methods.
You can use movie clips with drawing methods as masks; however, as with all movie clip masks, strokes are ignored.
createEmptyMovieClip()
to create an empty movie clip on the Stage.
The new movie clip is a child of an existing movie clip or of the main Timeline, as in the following example:
_root.createEmptyMovieClip ("triangle", 1);
The following example draws a triangle with 5-point magenta lines and no fill:
with (_root.triangle) { lineStyle (5, 0xff00ff, 100); moveTo (200, 200); lineTo (300, 300); lineTo (100, 300); lineTo (200, 200); }
For detailed information on these methods, see their entries in ActionScript Dictionary Overview.
![]() | |
![]() | |
![]() | |
![]() ![]() ![]() |