mx.graphics

# SolidColorStroke - AS3 Flex

Package | mx.graphics
Class | public class SolidColorStroke
Inheritance | SolidColorStroke EventDispatcher Object
Implements | IStroke
Subclasses | Stroke

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The SolidColorStroke class defines the properties for a line. You can define a SolidColorStroke object in MXML, but you must attach that SolidColorStroke to another object for it to appear in your application. The following example defines two SolidColorStroke objects and then uses them in the horizontalAxisRenderer of a LineChart control:

      ...
      <mx:SolidColorStroke id="ticks" color="0xFF0000" weight="1"/>
      <mx:SolidColorStroke id="mticks" color="0x0000FF" weight="1"/>

      <mx:LineChart id="mychart" dataProvider="{ndxa}">
          <mx:horizontalAxisRenderer>
              <mx:AxisRenderer placement="bottom" canDropLabels="true">
                  <mx:tickStroke>{ticks}</mx:tickStroke>
                  <mx:minorTickStroke>{mticks}</mx:minorTickStroke>
              </mx:AxisRenderer>
          </mx:horizontalAxisRenderer>
      </LineChart>
      ...

MXML Syntax Show MXML Syntax
Hide MXML Syntax

The `<mx:SolidColorStroke>` tag inherits all the tag attributes of its superclass, and adds the following tag attributes:

      <mx:SolidColorStroke
        Properties
        alpha="1.0"
        caps="round|none|square"
        color="0x000000"
        joints="round|bevel|miter"
        miterLimit="3"
        pixelHinting="false|true"
        scaleMode="normal|none|horizontal|vertical"
        weight="1 (in most cases)"
      />

More examples

Using strokes with chart controls
FXG
Paths in FXG and MXML graphics
Libraries and symbols in FXG and MXML graphics
Groups in FXG and MXML graphics
Shapes in FXG and MXML graphics
Text in FXG and MXML graphics
Fills in FXG and MXML graphics
Bitmap graphics in FXG and MXML graphics
Effects in FXG and MXML graphics

Learn more

Graphics classes and elements
MXML graphics

Related API Elements

flash.display.Graphics

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined By
--- | --- | ---
|  | alpha : Number The transparency of a line. | SolidColorStroke
|  | caps : String Specifies the type of caps at the end of lines. | SolidColorStroke
|  | color : uint The line color. | SolidColorStroke
|  | constructor : Object A reference to the class object or constructor function for a given object instance. | Object
|  | joints : String Specifies the type of joint appearance used at angles. | SolidColorStroke
|  | miterLimit : Number Indicates the limit at which a miter is cut off. | SolidColorStroke
|  | pixelHinting : Boolean Specifies whether to hint strokes to full pixels. | SolidColorStroke
|  | scaleMode : String A value from the LineScaleMode class that specifies which scale mode to use. | SolidColorStroke
|  | weight : Number The line weight, in pixels. | SolidColorStroke

Public Methods
Hide Inherited Public Methods
Show Inherited Public Methods

| Method | Defined By
--- | --- | ---
|  | SolidColorStroke(color:uint = 0x000000, weight:Number = 1, alpha:Number = 1.0, pixelHinting:Boolean = false, scaleMode:String = "normal", caps:String = "round", joints:String = "round", miterLimit:Number = 3) Constructor. | SolidColorStroke
|  | 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(graphics:Graphics, targetBounds:Rectangle, targetOrigin:Point):void Applies the properties to the specified Graphics object. | SolidColorStroke
|  | createGraphicsStroke(targetBounds:Rectangle, targetOrigin:Point):GraphicsStroke Generates a GraphicsStroke object representing this stroke. | SolidColorStroke
|  | dispatchEvent(event:Event):Boolean Dispatches an event into the event flow. | EventDispatcher
|  | hasEventListener(type:String):Boolean Checks whether the EventDispatcher object has any listeners registered for a specific type of event. | EventDispatcher
|  | hasOwnProperty(name:String):Boolean Indicates whether an object has a specified property defined. | Object
|  | isPrototypeOf(theClass:Object):Boolean Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter. | Object
|  | propertyIsEnumerable(name:String):Boolean Indicates whether the specified property exists and is enumerable. | Object
|  | removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void Removes a listener from the EventDispatcher object. | EventDispatcher
|  | setPropertyIsEnumerable(name:String, isEnum:Boolean = true):void Sets the availability of a dynamic property for loop operations. | Object
|  | toLocaleString():String Returns the string representation of this object, formatted according to locale-specific conventions. | Object
|  | toString():String Returns the string representation of the specified object. | Object
|  | valueOf():Object Returns the primitive value of the specified object. | Object
|  | willTrigger(type:String):Boolean Checks whether an event listener is registered with this EventDispatcher object or any of its ancestors for the specified event type. | EventDispatcher

Events
Click for more information on events
Hide Inherited Events
Show Inherited Events

| Event | Summary | Defined By
--- | --- | --- | ---
|  | activate | [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher
|  | deactivate | [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher

Property Detail

### alpha

property

`alpha:Number`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The transparency of a line. Possible values are 0.0 (invisible) through 1.0 (opaque).

The default value is `1.0..`

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 alpha():Number`
`public function set alpha(value:Number):void`

### caps

property

`caps:String`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Specifies the type of caps at the end of lines. Valid values are: `CapsStyle.ROUND`, `CapsStyle.SQUARE`, and `CapsStyle.NONE`.

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`

### color

property

`color:uint`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The line color.

The default value is `0x000000 (black)..`

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 color():uint`
`public function set color(value:uint):void`

### joints

property

`joints:String`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Specifies the type of joint appearance used at angles. Valid values are `JointStyle.ROUND`, `JointStyle.MITER`, and `JointStyle.BEVEL`.

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`

### miterLimit

property

`miterLimit:Number`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Indicates the limit at which a miter is cut off. Valid values range from 1 to 255.

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

Specifies whether to hint strokes to full pixels. This value affects both the position of anchors of a curve and the line stroke size itself.

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

A value from the LineScaleMode class that 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`

### weight

property

`weight:Number`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

The line weight, in pixels. For many charts, the default value is 1 pixel.

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

### SolidColorStroke

()
Constructor

`public function SolidColorStroke(color:uint = 0x000000, weight:Number = 1, alpha:Number = 1.0, 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

| `color:uint` (default = `0x000000`)`` — Specifies the line color. The default value is 0x000000 (black).
| `weight:Number` (default = `1`)`` — Specifies the line weight, in pixels. The default value is 1.
| `alpha:Number` (default = `1.0`)`` — Specifies the alpha value in the range 0.0 to 1.0. The default value is 1.0 (opaque).
| `pixelHinting:Boolean` (default = `false`)`` — Specifies whether to hint strokes to full pixels. This value affects both the position of anchors of a curve and the line stroke size itself. The default value is 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`")`` — Specifies the type of caps at the end of lines. Valid values are `CapsStyle.ROUND`, `CapsStyle.SQUARE`, and `CapsStyle.NONE`. The default value is `CapsStyle.ROUND`.
| `joints:String` (default = "`round`")`` — Specifies the type of joint appearance used at angles. Valid values are `JointStyle.ROUND`, `JointStyle.MITER`, and `JointStyle.BEVEL`. The default value is `JointStyle.ROUND`.
| `miterLimit:Number` (default = `3`)`` — Indicates the limit at which a miter is cut off. Valid values range from 1 to 255. The default value is 3.

Method Detail

### apply

()
method

`public function apply(graphics:Graphics, targetBounds:Rectangle, targetOrigin:Point):void`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

Applies the properties to the specified Graphics object.

Parameters

| `graphics: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`

Language Version: | ActionScript 3.0

Product Version: | Flex 3

Runtime Versions: | Flash Player 9, AIR 1.1

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.

© 2015 Adobe Systems Incorporated. All rights reserved.
Mon Apr 10 2017, 12:28 PM -07:00