ActionScript 2.0 Language Reference |
|
|
|
| ActionScript classes > GradientGlowFilter (flash.filters.GradientGlowFilter) > colors (GradientGlowFilter.colors property) | |||
public colors : Array
An array of colors that defines a gradient. For example, red is 0xFF0000, blue is 0x0000FF, and so on.
The colors property cannot be changed by directly modifying its values. Instead, you must get a reference to colors, make the change to the reference, and then set colors to the reference.
The colors, alphas, and ratios properties are all related. The first element in the colors array corresponds to the first element in the alphas array and in the ratios array, and so on.
Availability: ActionScript 1.0; Flash Player 8
The following example changes the colors property on an existing movie clip when a user clicks it.
import flash.filters.GradientGlowFilter;
var mc:MovieClip = createGradientGlowRectangle("GlowColors");
mc.onRelease = function() {
var filter:GradientGlowFilter = this.filters[0];
var colors:Array = filter.colors;
colors.pop();
colors.push(0xFF00FF);
filter.colors = colors;
this.filters = new Array(filter);
}
function createGradientGlowRectangle(name:String):MovieClip {
var art:MovieClip = this.createEmptyMovieClip(name, this.getNextHighestDepth());
var w:Number = 100;
var h:Number = 100;
art.beginFill(0x003366);
art.lineTo(w, 0);
art.lineTo(w, h);
art.lineTo(0, h);
art.lineTo(0, 0);
art._x = 20;
art._y = 20;
var colors:Array = [0xFFFFFF, 0xFF0000, 0xFFFF00, 0x00CCFF];
var alphas:Array = [0, 1, 1, 1];
var ratios:Array = [0, 63, 126, 255];
var filter:GradientGlowFilter = new GradientGlowFilter(0, 45, colors, alphas, ratios, 55, 55, 2.5, 2, "outer", false);
var filterArray:Array = new Array();
filterArray.push(filter);
art.filters = filterArray;
return art;
}
alphas (GradientGlowFilter.alphas property), ratios (GradientGlowFilter.ratios property)
|
|
|
|