MovieClip.beginGradientFill() 491
If a matrixType property does not exist then the remaining parameters are all required; the
function fails if any of them are missing. This matrix scales, translates, rotates, and skews the
unit gradient, which is defined at (-1,-1) and (1,1).
• matrixType, x, y, w, h, r.
The properties indicate the following:
matrixType is the string "box", x is the horizontal
position relative to the registration point of the parent clip for the upper left corner of the
gradient,
y is the vertical position relative to the registration point of the parent clip for the
upper left corner of the gradient,
w is the width of the gradient, h is the height of the gradient,
and
r is the rotation in radians of the gradient.
The following example uses a
beginGradientFill() method with a matrix parameter that is
an object with these properties.
_root.createEmptyMovieClip( "grad", 1 );
with ( _root.grad )
{
colors = [ 0xFF0000, 0x0000FF ];
alphas = [ 100, 100 ];
ratios = [ 0, 0xFF ];
matrix = { matrixType:"box", x:100, y:100, w:200, h:200, r:(45/
180)*Math.PI };
beginGradientFill( "linear", colors, alphas, ratios, matrix );
moveto(100,100);
lineto(100,300);
lineto(300,300);
lineto(300,100);
lineto(100,100);
endFill();
}
If a matrixType property exists then it must equal "box" and the remaining parameters are all
required. The function fails if any of these conditions are not met.