
Код:
import flash.geom.*;
MovieClip.prototype.p_drawGradient = function (gWidth, gHeight) {
with (this) {
colors = [0xFF00FF, 0x00FFFF];
fillType = "linear";
alphas = [100, 100];
ratios = [0, 0xFF];
spreadMethod = "pad";
interpolationMethod = "linearRGB";
focalPointRatio = 0;
matrix = new Matrix ();
matrix.createGradientBox (gWidth, gHeight, 90*Math.PI/180, 0, 0);
beginGradientFill (fillType, colors, alphas, ratios, matrix, spreadMethod, interpolationMethod, focalPointRatio);
moveTo (0, 0);
lineTo (0, gHeight);
lineTo (gWidth, gHeight);
lineTo (gWidth, 0);
lineTo (0, 0);
endFill ();
}
};
_root.createEmptyMovieClip ("gr", 1);
gr.p_drawGradient (100, 100);