User Guide
884 ActionScript classes
focalPointRatio:Number [optional] - A Number that controls the location of the focal
point of the gradient. The value 0 means the focal point is in the center. The value 1 means
the focal point is at one border of the gradient circle. The value -1 means that the focal point
is at the other border of the gradient circle. Values less than -1 or greater than 1 are rounded to
-1 or 1. The following image shows a gradient with a
focalPointRatio of -0.75:
Example
The following code uses both methods to draw two stacked rectangles with a red-blue line
gradient fill:
this.createEmptyMovieClip("gradient_mc", 1);
with (gradient_mc) {
colors = [0xFF0000, 0x0000FF];
alphas = [100, 100];
ratios = [0, 0xFF];
matrix = {a:500, b:0, c:0, d:0, e:200, f:0, g:350, h:200, i:1};
lineStyle(16);
lineGradientStyle("linear", colors, alphas, ratios, matrix);
moveTo(100, 100);
lineTo(100, 300);
lineTo(600, 300);
lineTo(600, 100);
lineTo(100, 100);
endFill();
matrix2 = {matrixType:"box", x:100, y:310, w:500, h:200, r:(30/
180)*Math.PI};
lineGradientStyle("linear", colors, alphas, ratios, matrix2);
moveTo(100, 320);
lineTo(100, 520);
lineTo(600, 520);
lineTo(600, 320);
lineTo(100, 320);
endFill();
}