代码
var fillType:String = GradientType.LINEAR;
var colors:Array = [0xFF0000, 0xFFCC00];
var alphas:Array = [1,0.1];//可以设置渐变两边的alpha值,1<alpha>0
var ratios:Array = [0x00, 0xFF];
var matr:Matrix = new Matrix();
matr.createGradientBox(20, 20, 0, 0, 0);
var spreadMethod:String = SpreadMethod.PAD;
this.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);
this.graphics.drawRect(0,0,100,100);
var colors:Array = [0xFF0000, 0xFFCC00];
var alphas:Array = [1,0.1];//可以设置渐变两边的alpha值,1<alpha>0
var ratios:Array = [0x00, 0xFF];
var matr:Matrix = new Matrix();
matr.createGradientBox(20, 20, 0, 0, 0);
var spreadMethod:String = SpreadMethod.PAD;
this.graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);
this.graphics.drawRect(0,0,100,100);