Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
mx.graphics 
GradientStroke 
Packagemx.graphics
Classpublic class GradientStroke
InheritanceGradientStroke Inheritance GradientBase Inheritance EventDispatcher Inheritance Object
Implements IStroke
Subclasses LinearGradientStroke, RadialGradientStroke

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The GradientStroke class lets you specify a gradient filled stroke. You use the GradientStroke class, along with the GradientEntry class, to define a gradient stroke.

Default MXML Propertyentries

See also



Public Properties
 PropertyDefined By
 Inheritedangle : Number
Deprecated: Please Use rotation
By default, the LinearGradientStroke defines a transition from left to right across the control.
GradientBase
  caps : String
Specifies the appearance of the ends of lines.
GradientStroke
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
 Inheritedentries : Array
An Array of GradientEntry objects defining the fill patterns for the gradient fill.
GradientBase
 InheritedinterpolationMethod : String
A value from the InterpolationMethod class that specifies which interpolation method to use.
GradientBase
  joints : String
A value from the JointStyle class that specifies the type of joint appearance used at angles.
GradientStroke
 Inheritedmatrix : Matrix
An array of values used for matrix transformation.
GradientBase
  miterLimit : Number
A number that indicates the limit at which a miter is cut off.
GradientStroke
  pixelHinting : Boolean
A Boolean value that specifies whether to hint strokes to full pixels.
GradientStroke
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
 Inheritedrotation : Number
By default, the LinearGradientStroke defines a transition from left to right across the control.
GradientBase
  scaleMode : String
Specifies which scale mode to use.
GradientStroke
 InheritedspreadMethod : String
A value from the SpreadMethod class that specifies which spread method to use.
GradientBase
  weight : Number
The stroke weight, in pixels.
GradientStroke
 Inheritedx : Number
The distance by which to translate each point along the x axis.
GradientBase
 Inheritedy : Number
The distance by which to translate each point along the y axis.
GradientBase
Protected Properties
 PropertyDefined By
 InheritedcompoundTransform : mx.geom:CompoundTransform
Holds the matrix and the convenience transform properties (x, y, and rotation).
GradientBase
Public Methods
 MethodDefined By
  
GradientStroke(weight:Number = 1, pixelHinting:Boolean = false, scaleMode:String = "normal", caps:String = "round", joints:String = "round", miterLimit:Number = 3)
Constructor.
GradientStroke
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener receives notification of an event.
EventDispatcher
  
apply(g:Graphics, targetBounds:Rectangle, targetOrigin:Point):void
Applies the properties to the specified Graphics object.
GradientStroke
  
Generates a GraphicsStroke object representing this stroke.
GradientStroke
 Inherited
Dispatches an event into the event flow.
EventDispatcher
 Inherited
Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
EventDispatcher
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Removes a listener from the EventDispatcher object.
EventDispatcher
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of this object, formatted according to locale-specific conventions.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
 Inherited
Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type.
EventDispatcher
Events
 Event Summary Defined By
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active.EventDispatcher
 Inherited[broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive.EventDispatcher
Public Constants
 ConstantDefined By
 InheritedGRADIENT_DIMENSION : Number = 1638.4
[static] Value of the width and height of the untransformed gradient
GradientBase
Property Detail

caps

property
caps:String

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Specifies the appearance of the ends of lines.

Valid values are CapsStyle.NONE, CapsStyle.ROUND, and CapsStyle.SQUARE. A null value is equivalent to CapsStyle.ROUND.

The default value is CapsStyle.ROUND.

This property can be used as the source for data binding. When this property is modified, it dispatches the propertyChange event.



Implementation
    public function get caps():String
    public function set caps(value:String):void

See also

flash.display.CapStyle

joints

property 
joints:String

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

A value from the JointStyle class that specifies the type of joint appearance used at angles.

Valid values are JointStyle.BEVEL, JointStyle.MITER, and JointStyle.ROUND. A null value is equivalent to JointStyle.ROUND.

The default value is JointStyle.ROUND.

This property can be used as the source for data binding. When this property is modified, it dispatches the propertyChange event.



Implementation
    public function get joints():String
    public function set joints(value:String):void

See also

miterLimit

property 
miterLimit:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

A number that indicates the limit at which a miter is cut off.

Valid values range from 0 to 255 (and values outside of that range are rounded to 0 or 255).

This value is only used if the jointStyle property is set to JointStyle.MITER.

The value of the miterLimit property represents the length that a miter can extend beyond the point at which the lines meet to form a joint. The value expresses a factor of the line thickness. For example, with a miterLimit factor of 2.5 and a thickness of 10 pixels, the miter is cut off at 25 pixels.

The default value is 3.

This property can be used as the source for data binding. When this property is modified, it dispatches the propertyChange event.



Implementation
    public function get miterLimit():Number
    public function set miterLimit(value:Number):void

pixelHinting

property 
pixelHinting:Boolean

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

A Boolean value that specifies whether to hint strokes to full pixels.

This affects both the position of anchors of a curve and the line stroke size itself.

With pixelHinting set to true, Flash Player and AIR hint line widths to full pixel widths. With pixelHinting set to false, disjoints can appear for curves and straight lines.

The default value is false.

This property can be used as the source for data binding. When this property is modified, it dispatches the propertyChange event.



Implementation
    public function get pixelHinting():Boolean
    public function set pixelHinting(value:Boolean):void

scaleMode

property 
scaleMode:String

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Specifies which scale mode to use. Value valids are:

  • LineScaleMode.NORMAL— Always scale the line thickness when the object is scaled (the default).
  • LineScaleMode.NONE— Never scale the line thickness.
  • LineScaleMode.VERTICAL— Do not scale the line thickness if the object is scaled vertically only.
  • LineScaleMode.HORIZONTAL— Do not scale the line thickness if the object is scaled horizontally only.

The default value is LineScaleMode.NORMAL.

This property can be used as the source for data binding. When this property is modified, it dispatches the propertyChange event.



Implementation
    public function get scaleMode():String
    public function set scaleMode(value:String):void

See also

weight

property 
weight:Number

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

The stroke weight, in pixels.

This property can be used as the source for data binding. When this property is modified, it dispatches the propertyChange event.



Implementation
    public function get weight():Number
    public function set weight(value:Number):void
Constructor Detail

GradientStroke

()Constructor
public function GradientStroke(weight:Number = 1, pixelHinting:Boolean = false, scaleMode:String = "normal", caps:String = "round", joints:String = "round", miterLimit:Number = 3)

Language Version: ActionScript 3.0
Product Version: Flex 3
Runtime Versions: Flash Player 9, AIR 1.1

Constructor.

Parameters
weight:Number (default = 1) — Specifies the line weight, in pixels. This parameter is optional, with a default value of 1.
 
pixelHinting:Boolean (default = false) — A Boolean value that specifies whether to hint strokes to full pixels. This affects both the position of anchors of a curve and the line stroke size itself. With pixelHinting set to true, Flash Player and AIR hint line widths to full pixel widths. With pixelHinting set to false, disjoints can appear for curves and straight lines. This parameter is optional, with a default value of false.
 
scaleMode:String (default = "normal") — A value from the LineScaleMode class that specifies which scale mode to use. Valid values are LineScaleMode.HORIZONTAL, LineScaleMode.NONE, LineScaleMode.NORMAL, and LineScaleMode.VERTICAL. This parameter is optional, with a default value of LineScaleMode.NORMAL.
 
caps:String (default = "round") — A value from the CapsStyle class that specifies the type of caps at the end of lines. Valid values are CapsStyle.NONE, CapsStyle.ROUND, and CapsStyle.SQUARE. A null value is equivalent to CapsStyle.ROUND. This parameter is optional, with a default value of CapsStyle.ROUND.
 
joints:String (default = "round") — A value from the JointStyle class that specifies the type of joint appearance used at angles. Valid values are JointStyle.BEVEL, JointStyle.MITER, and JointStyle.ROUND. A null value is equivalent to JointStyle.ROUND. This parameter is optional, with a default value of JointStyle.ROUND.
 
miterLimit:Number (default = 3) — A number that indicates the limit at which a miter is cut off. Valid values range from 1 to 255 (and values outside of that range are rounded to 1 or 255). This value is only used if the jointStyle property is set to miter. The miterLimit value represents the length that a miter can extend beyond the point at which the lines meet to form a joint. The value expresses a factor of the line thickness. For example, with a miterLimit factor of 2.5 and a thickness of 10 pixels, the miter is cut off at 25 pixels. This parameter is optional, with a default value of 3.
Method Detail

apply

()method
public function apply(g:Graphics, targetBounds:Rectangle, targetOrigin:Point):void

Language Version: ActionScript 3.0
Product Version: Flex 4
Runtime Versions: Flash Player 9, AIR 1.1

Applies the properties to the specified Graphics object.

Parameters

g:Graphics — The Graphics object to apply the properties to.
 
targetBounds:Rectangle — The bounds of the shape that the stroke is applied to.
 
targetOrigin:Point — The Point that defines the origin (0,0) of the shape in the coordinate system of target.

createGraphicsStroke

()method 
public function createGraphicsStroke(targetBounds:Rectangle, targetOrigin:Point):GraphicsStroke

Generates a GraphicsStroke object representing this stroke.

Parameters

targetBounds:Rectangle — The stroke's bounding box.
 
targetOrigin:Point — The Point that defines the origin (0,0) of the shape in the coordinate system of target.

Returns
GraphicsStroke — The Drawing API-2 GraphicsStroke object representing this stroke.