| Package | com.afcomponents.umap.styles |
| Class | public class GradientStyle |
| Inheritance | GradientStyle Style |
GeometryStyle class
in the GeometryStyle.fillGradient and GeometryStyle.strokeGradient properties.
GradientStyle & GeometryStyle classes
for creating a gradient-filled rectangle:
import com.afcomponents.umap.styles.GeometryStyle;
import com.afcomponents.umap.styles.GradientStyle;
import flash.geom.Matrix;
import flash.display.GradientType;
import flash.display.SpreadMethod;
// create new geometry style & define gradient fill style
var style:GeometryStyle = new GeometryStyle();
style.stroke = GeometryStyle.NONE;
style.fill = GeometryStyle.GRADIENT;
style.fillGradient = new GradientStyle();
with (style.fillGradient)
{
type = GradientType.LINEAR;
colors = [0xFFCC00, 0x000000];
alphas = [100, 100];
ratios = [0x00, 0xFF];
matrix = new Matrix();
matrix.createGradientBox(20, 20, 0, 0, 0);
spreadMethod = SpreadMethod.REFLECT;
}
// apply geometry style to draw gradient-filled rectangle
style.applyTo(this.graphics);
this.graphics.drawRect(0,0,100,100); You should see a gradient-filled rectangle after executing the code:
See also
| Property | Defined by | ||
|---|---|---|---|
| alphas : Array = null
An array of alpha values for the corresponding colors in the colors array.
| GradientStyle | ||
| colors : Array = null
An array of RGB hexadecimal color values to be used in the gradient.
| GradientStyle | ||
| focalPointRatio : Number = 0
A number that controls the location of the focal point of the gradient.
| GradientStyle | ||
| interpolationMethod : String = "rgb"
A value from the
InterpolationMethod class that specifies which value to use. | GradientStyle | ||
| matrix : Matrix = null
A transformation matrix as defined by the
flash.geom.Matrix class. | GradientStyle | ||
| ratios : Array = null
An array of color distribution ratios.
| GradientStyle | ||
| spreadMethod : String = "pad"
A value from the
SpreadMethod class that specifies which spread method to use. | GradientStyle | ||
| type : String = "null"
A value from the
GradientType class that specifies which gradient type to use. | GradientStyle | ||
| Method | Defined by | ||
|---|---|---|---|
|
GradientStyle(param:Object = null)
GradientStyle contructor.
| GradientStyle | ||
![]() |
Creates a copy of the
Style object. | Style | |
![]() |
Creates a clone of this
Style,
copies the properties from specified object and returns the new style. | Style | |
![]() |
copy(object:Object):void
Copies all the properties from the specified object into the
Style object. | Style | |
![]() |
copyStyle(dest:Object, src:Object):void
[static]
Copies all properties of one object into another.
| Style | |
![]() |
getStyleFromXML(xml:XML):Style
[static]
Returns new
Style object, from the source XML object. | Style | |
![]() |
getXMLFromStyle(style:Style, name:String = ""):XML
[static]
Returns an
XML object that represents all the style's properties. | Style | |
![]() |
toString():String
Returns a
String that represents all the style's properties. | Style | |
![]() |
toXML(afcTags:Boolean = false):XML
Abstract function.
| Style | |
| alphas | property |
public var alphas:Array = nullAn 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 null.
| colors | property |
public var colors:Array = nullAn array of RGB hexadecimal color values to be 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, be sure you specify a corresponding value in the alphas and ratios parameters.
The default value is null.
| focalPointRatio | property |
public var focalPointRatio:Number = 0A number that controls the location of the focal point of the gradient.
0 means that the focal point is in the center. 1 means that the focal point is at one border of the gradient circle. -1 means that the focal point is at the other border of the gradient circle. A value less than -1 or greater than 1 is rounded to -1 or 1.
The default value is 0.
| interpolationMethod | property |
public var interpolationMethod:String = "rgb"
A value from the InterpolationMethod class that specifies which value to use.
Possible values are InterpolationMethod.linearRGB and InterpolationMethod.RGB.
The default value is InterpolationMethod.RGB.
| matrix | property |
public var matrix:Matrix = null
A transformation matrix as defined by the flash.geom.Matrix class.
The flash.geom.Matrix class includes a createGradientBox() method,
which lets you conveniently set up the matrix for use with the beginGradientFill() method.
The default value is null.
See also
| ratios | property |
public var ratios:Array = nullAn array of color distribution ratios.
Valid values are 0 to 255. This value defines the percentage of the width where the color is sampled at 100%. The value 0 represents the left-hand position in the gradient box, and 255 represents the right-hand position in the gradient box.
The default value is null.
| spreadMethod | property |
public var spreadMethod:String = "pad"
A value from the SpreadMethod class that specifies which spread method to use.
Possible values include: SpreadMethod.PAD, SpreadMethod.REFLECT, and SpreadMethod.REPEAT
The default value is SpreadMethod.PAD.
| type | property |
public var type:String = "null"
A value from the GradientType class that specifies which gradient type to use.
Possible values are GradientType.LINEAR and GradientType.RADIAL.
The default value is null.
| GradientStyle | () | constructor |
public function GradientStyle(param:Object = null)GradientStyle contructor.
Creates new GradientStyle object with the default parameters.
Properties defined in param object will override the default values.
param:Object (default = null) — Object that holds all the properites of a style you wish to override upon its creation.
|