Gradient (Gradient)
Sprite
|
+--Gradient
- class Gradient
extends Sprite
Creates a new Gradient DisplayObject
See Sprite for a complete list of inherited properites and methods
Property summary
| Property | Description |
|---|---|
| alphas:Array | An array of alpha values for the corresponding colors in the colors array; valid values are 0 to 1. If the value is less than 0, the default is 0. If the value is greater than 1, the default is 1. The default value is [1, 1] |
| colors:Array | An array of RGB hexadecimal color values used in the gradient; for example, red is 0xFF0000, blue is 0x0000FF, and so on.
You can specify up to 15 colors. For each color, specify a corresponding value in the alphas and ratios parameters. |
| direction:String | Get or set the gradients spread direction.
Acceptable values are: Gradient.HORIZONTAL or Gradient.VERTICAL and ‘horizontal’ or ‘vertical’. The default value is ‘horizontal’. |
| radius:Number | Get or set the width of the ellipse used to draw the rounded corners (in pixels).
The default value is 0 |
| ratios:Array | An array of color distribution ratios; valid values are 0-255. This value defines the percentage of the width where the color is sampled at 100%. The value 0 represents the left position in the gradient box, and 255 represents the right position in the gradient box. The default value is [0, 255]; |
| spread:String | A value from the SpreadMethod class that specifies which spread method to use, either: SpreadMethod.PAD , SpreadMethod.REFLECT , or SpreadMethod.REPEAT. The default value is ‘pad’. |
| width:Number | Indicates the width of the display object, in pixels. |
| height:Number | Indicates the height of the display object, in pixels. |
Method summary
| Method | Description |
|---|---|
| moveTo(destX:Number, destY:Number) : void | Moves the Gradient DisplayObject to the specified x,y coordinates. |
| applyTo(target:*) : void | Applies the gradient to the graphics of the supplied target DisplayObject The target MUST have the ‘graphics’ property available. |
Gradient()
Description
Creates a new Gradient DisplayObject
moveTo(destX:Number, destY:Number) : void
Usage
public function moveTo(destX:Number, destY:Number):void
Parameters
Returns
Nothing.
Description
Moves the Gradient DisplayObject to the specified x,y coordinates.
applyTo(target:*) : void
Usage
public function applyTo(target:*):void
Parameters
Returns
Nothing.
Description
Applies the gradient to the graphics of the supplied target DisplayObject. The target MUST have the ‘graphics’ property available.
alphas : Array
Usage
public function get alphas():Array
Description
An array of alpha values for the corresponding colors in the colors array; valid values are 0 to 1. If the value is less than 0, the default is 0. If the value is greater than 1, the default is 1.
The default value is [1, 1].
colors : Array
Usage
public function get colors():Array
Description
An array of RGB hexadecimal color values used in the gradient; for example, red is 0xFF0000, blue is 0x0000FF, and so on.
You can specify up to 15 colors. For each color, specify a corresponding value in the alphas and ratios parameters.
You must specify at least 2 colors. Exampe: [0x000000, 0x333333]
direction : String
Usage
public function get direction():String
Description
Get or set the gradients spread direction.
Acceptable values are: Gradient.HORIZONTAL or Gradient.VERTICAL and ‘horizontal’ or ‘vertical’.
The default value is ‘horizontal’.
radius : Number
Usage
public function get radius():Number
Description
Get or set the width of the ellipse used to draw the rounded corners (in pixels).
The default value is 0
ratios : Array
Usage
public function get ratios():Array
Description
An array of color distribution ratios; valid values are 0-255. This value defines the percentage of the width where the color is sampled at 100%.
The value 0 represents the left position in the gradient box, and 255 represents the right position in the gradient box.
The default value is [0, 255];
spread : String
Usage
public function get spread():String
Description
A value from the SpreadMethod class that specifies which spread method to use, either: SpreadMethod.PAD , SpreadMethod.REFLECT , or SpreadMethod.REPEAT.
The default value is ‘pad’.
width : Number
Usage
override public function get width():Number
Description
Indicates the width of the display object, in pixels.
height : Number
Usage
override public function get height():Number
Description
Indicates the height of the display object, in pixels.