Package | flash.display |
Class | public final class JointStyle |
Inheritance | JointStyle ![]() |
joints
parameter of the
flash.display.Graphics.lineStyle()
method. The method supports three types of joints:
miter, round, and bevel, as the following example shows:
See also
Constant | Defined By | ||
---|---|---|---|
BEVEL : String = "bevel" [static]
Specifies beveled joints in the joints parameter of the
flash.display.Graphics.lineStyle() method. | JointStyle | ||
MITER : String = "miter" [static]
Specifies mitered joints in the joints parameter of the
flash.display.Graphics.lineStyle() method. | JointStyle | ||
ROUND : String = "round" [static]
Specifies round joints in the joints parameter of the
flash.display.Graphics.lineStyle() method. | JointStyle |
BEVEL | Constant |
public static const BEVEL:String = "bevel"
Specifies beveled joints in the joints
parameter of the
flash.display.Graphics.lineStyle()
method.
MITER | Constant |
public static const MITER:String = "miter"
Specifies mitered joints in the joints
parameter of the
flash.display.Graphics.lineStyle()
method.
ROUND | Constant |
public static const ROUND:String = "round"
Specifies round joints in the joints
parameter of the
flash.display.Graphics.lineStyle()
method.
doDrawCorner()
method three times using the three joint styles (miter,
round, and bevel). Each of the three calls to doDrawCorner()
uses the joint style and
properties previously listed to draw two connected line segments and associated line highlights. This is done by
first creating a new Shape object child
and then using methods of the Graphics
class to set the line style and draw the lines and highlights. Each instance of child
is added to the display list and promptly drawn on the stage.refreshLayout()
method
at y = 80 pixels and starting at x = 80 pixels, with a 25-pixel separation between the line segments.package { import flash.display.DisplayObject; import flash.display.Graphics; import flash.display.JointStyle; import flash.display.LineScaleMode; import flash.display.Shape; import flash.display.Sprite; public class JointStyleExample extends Sprite { private var size:uint = 80; private var borderColor:uint = 0xFFCC00; private var borderSize:uint = 30; private var highlightColor:uint = 0x666666; private var highlightSize:uint = 0; private var gutter:uint = 25; private var borderAlpha:uint = 1; private var borderPixelHinting:Boolean = false; private var borderScaleMode:String = LineScaleMode.NORMAL; private var borderCaps:String; private var borderMiterLimit:uint; public function JointStyleExample() { doDrawCorner(JointStyle.MITER); doDrawCorner(JointStyle.ROUND); doDrawCorner(JointStyle.BEVEL); refreshLayout(); } private function doDrawCorner(jointStyle:String):void { var halfSize:uint = Math.round(size / 2); var child:Shape = new Shape(); child.graphics.lineStyle(borderSize, borderColor, borderAlpha, borderPixelHinting, borderScaleMode, borderCaps, jointStyle, borderMiterLimit); child.graphics.lineTo(0, 0); child.graphics.lineTo(size, 0); child.graphics.lineTo(halfSize, size); child.graphics.endFill(); child.graphics.moveTo(0, 0); child.graphics.lineStyle(highlightSize, highlightColor); child.graphics.lineTo(0, 0); child.graphics.lineTo(size, 0); child.graphics.lineTo(halfSize, size); addChild(child); } private function refreshLayout():void { var ln:uint = numChildren; var child:DisplayObject; var lastChild:DisplayObject = getChildAt(0); lastChild.x = size; lastChild.y = size; for (var i:uint = 1; i < ln; i++) { child = getChildAt(i); child.x = gutter + lastChild.x + lastChild.width; child.y = size; lastChild = child; } } } }