EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 548

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
548 Animation, Filters, and Drawings
Using line styles
The Flash Drawing API lets you specify a line style that Flash uses for subsequent calls to
MovieClip.lineTo() and MovieClip.curveTo() until you call MovieClip.lineStyle()
with different parameters, as follows:
lineStyle(thickness:Number, rgb:Number, alpha:Number, pixelHinting:Boolean,
noScale:String, capsStyle:String, jointStyle:String, miterLimit:Number)
You can call MovieClip.lineStyle() in the middle of drawing a path to specify different
styles for different line segments within a path.
For more information on using ActionScript to set line styles, see the following sections:
“Setting stroke and caps styles” on page 548
“Setting parameters of line styles” on page 549
Setting stroke and caps styles
Flash 8 includes several improvements to line drawing. New line parameters added in Flash
Player 8 are
pixelHinting, noScale, capsStyle, jointStyle, and miterLimit.
The following procedure demonstrates the difference between the three new caps styles in
Flash Player 8:
none, round, and square.
To set caps styles using ActionScript:
1. Create a new Flash document and save it as capstyle.fla.
2. Add the following ActionScript to Frame 1 of the Timeline:
// Set up grid movie clip.
this.createEmptyMovieClip("grid_mc", 50);
grid_mc.lineStyle(0, 0x999999, 100);
grid_mc.moveTo(50, 0);
grid_mc.lineTo(50, Stage.height);
grid_mc.moveTo(250, 0);
grid_mc.lineTo(250, Stage.height);
// line 1 (capsStyle: round)
this.createEmptyMovieClip("line1_mc", 10);
with (line1_mc) {
createTextField("label_txt", 1, 5, 10, 100, 20);
label_txt.text = "round";
lineStyle(20, 0x99FF00, 100, true, "none", "round", "miter", 0.8);
moveTo(0, 0);
lineTo(200, 0);
_x = 50;
_y = 50;
}
// line 2 (capsStyle: square)
this.createEmptyMovieClip("line2_mc", 20);

Table of Contents

Related product manuals