Fill object

 < Day Day Up > 

Availability

Flash MX 2004.

Description

This object contains all the properties of the Fill color setting of the Tools panel or of a selected shape. To retrieve a Fill object, use document.getCustomFill().

Property summary for the Fill object

The following properties are available for the Fill object:

Property

Description

fill.color

A string, hexadecimal value, or integer that represents the fill color.

fill.colorArray

An array of colors in gradient.

fill.focalPoint

An integer that specifies the gradient focal point horizontal offset from the transformation point.

fill.linearRGB

A Boolean value that specifies whether to render the fill as a linear or radial RGB gradient.

fill.matrix

A Matrix object that defines the placement, orientation, and scales for gradient fills.

fill.overflow

A string that specifies the behavior of a gradient's overflow.

fill.posArray

An array of integers, each in the range 0 ... 255, indicating the position of the corresponding color.

fill.style

A string that specifies the fill style.


fill.color

Availability

Flash MX 2004.

Usage

fill.color

Description

Property; the color of the fill, in one of the following formats:

  • A string in the format "#RRGGBB" or "#RRGGBBAA"

  • A hexadecimal number in the format 0xRRGGBB

  • An integer that represents the decimal equivalent of a hexadecimal number

Example

The following example sets the fill color of the current selection:

var fill = fl.getDocumentDOM().getCustomFill(); fill.color = '#FFFFFF'; fl.getDocumentDOM().setCustomFill( fill );

fill.colorArray

Availability

Flash MX 2004.

Usage

fill.colorArray

Description

Property; an array of colors in the gradient, expressed as integers. This property is available only if the value of the fill.style property is either "radialGradient" or "linearGradient". See fill.style

Example

The following example displays the color array of the current selection, if appropriate, in the Output panel:

var fill = fl.getDocumentDOM().getCustomFill(); if(fill.style == "linearGradient" || fill.style == "radialGradient")   alert(fill.colorArray);

fill.focalPoint

Availability

Flash 8.

Usage

fill.focalPoin

Description

Property; an integer that specifies the gradient focal point horizontal offset from the transformation point. A value of 10, for example, would place the focal point at 10/255 of the distance from the transformation point to the edge of the gradient. A value of -255 would place the focal point at the left boundary of the gradient. The default value is 0.

This property is available only if the value of the fill.style property is "radialGradient".

Example

The following example sets the focal point of a radial gradient to 10 pixels to the right of the shape's center.

var fill = fl.getDocumentDOM().getCustomFill(); fill.focalPoint = 10; fl.getDocumentDOM().setCustomFill(fill);

fill.linearRGB

Availability

Flash 8.

Usage

fill.linearRGB

Description

Property; a Boolean value that specifies whether to render the fill as a linear or radial RGB gradient. Set this property to TRue to specify a linear interpolation of a gradient; set it to false to specify a radial interpolation of a gradient. The default value is false.

Example

The following example specifies that the gradient should be rendered with a linear RGB.

var fill = fl.getDocumentDOM().getCustomFill(); fill.linearRGB = true; fl.getDocumentDOM().setCustomFill(fill);

fill.matrix

Availability

Flash MX 2004.

Usage

fill.matrix

Description

Property; a Matrix object that defines the placement, orientation, and scales for gradient fills.

fill.overflow

Availability

Flash 8.

Usage

fill.overflow

Description

Property; a string that specifies the behavior of a gradient's overflow. Acceptable values are "extend", "repeat", and "reflect"; the strings are not case-sensitive. The default value is "extend".

Example

The following example specifies that the behavior of the overflow should be "extend".

var fill = fl.getDocumentDOM().getCustomFill(); fill.overflow = "extend"; fl.getDocumentDOM().setCustomFill(fill);

fill.posArray

Availability

Flash MX 2004.

Usage

fill.posArray

Description

Property; an array of integers, each in the range 0 ... 255, indicating the position of the corresponding color. This property is available only if the value of the fill.style property is either "radialGradient" or "linearGradient".

Example

The following example specifies the colors to use in a linear gradient for the current selection:

var fill = fl.getDocumentDOM().getCustomFill(); fill.style = "linearGradient"; fill.colorArray = [ 0x00ff00, 0xff0000, 0x0000ff ]; fill.posArray = [0, 100, 200]; fl.getDocumentDOM().setCustomFill( fill );

fill.style

Availability

Flash MX 2004.

Usage

fill.style

Description

Property; a string that specifies the fill style. Acceptable values are "solid", "linearGradient", "radialGradient", and "noFill". If an object has no fill, this property has a value of "noFill".

If this value is "linearGradient" or "radialGradient", the properties fill.colorArray and fill.posArray are also available.

Example

The following example specifies the colors to use in a linear gradient for the current selection:

var fill = fl.getDocumentDOM().getCustomFill(); fill.style= "linearGradient"; fill.colorArray = [ 0x00ff00, 0xff0000, 0x0000ff ]; fill.posArray = [0, 100, 200]; fl.getDocumentDOM().setCustomFill( fill );

     < Day Day Up > 


    Developing Extensions for Macromedia Flash 8
    Developing Extensions for Macromedia Flash 8
    ISBN: 032139416X
    EAN: 2147483647
    Year: 2005
    Pages: 81

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net