Creating a gradient is different that defining a solid color fill. When creating a gradient, you need to create the gradient box and use the Matrix class to define the specification of your gradient.
This is pretty simple, and you should not be afraid of using Matrix. Also remember that gradient sizes and position are controlled by matrix, not by shape size.
import flash.display.GradientType;
import flash.geom.Matrix;
// For more detailed info see Help for GraphicsGradientFill.
// Gradient type.
var type:String;
// Gradient colors, can be more that two.
var colors:Array = [0x00FF00, 0x000088];
// Gradient colors alpha value for corresponding color.
var alphas:Array = [1, 1];
// Gradient colors distribution ratios.
var ratios:Array = [0, 255];
// Which spread method to use. Can be PAD, REFLECT, REPEAT.
var spreadMethod:String = SpreadMethod.PAD;
// Colors interpolation method to use, affect gradient colors pallete.
// Can be LINEAR_RGB or RGB.
var interpolaton:String = InterpolationMethod.RGB;
var boxWidth:Number = 100;
var boxHeight:Number = 100;
var boxRotation:Number = Math.PI/2; // 90 degrees
var tx:Number = 0;
var ty:Number = 0;
// Linear gradient creation.
type = GradientType.LINEAR;
var lGradShape:Shape = new Shape();
var matrix:Matrix = new Matrix();
matrix.createGradientBox(boxWidth, boxHeight, boxRotation, tx, ty);
lGradShape.graphics.beginGradientFill(type, colors, alphas, ratios,
matrix, spreadMethod, interpolaton, 0);
// Draw rectangle with our gradient fill in it.
lGradShape.graphics.drawRect(0, 0, 100, 100);
addChild(lGradShape);
// Radial gradient creation.
type = GradientType.RADIAL;
// Where gradient focal point will be placed.
// From -1 to 1, 0 - center; 1 - at the border.
var focalPtRatio:Number = 0;
var rGradShape:Shape = new Shape();
var radius:Number = 50;
matrix = new Matrix();
boxRotation = 0;
// Without the translation parameters (tx, ty) the center
// of the gradient will be at x = radius, y = radius.
// So the center of the gradient will be at lower right corner of the circle.
// Move the center of the gradient to the center of the circle.
tx = -radius;
ty = -radius;
matrix.createGradientBox(2 * radius, 2 * radius, boxRotation, tx, ty);
rGradShape.graphics.beginGradientFill(type, colors, alphas, ratios, matrix,
spreadMethod, interpolaton, focalPtRatio);
// Draw circle shape to fill it with radial gradient. You can draw rect or
// other shapes, but with circle it looks better.
rGradShape.graphics.drawCircle(0, 0, radius);
addChild(rGradShape);
rGradShape.x = lGradShape.x + lGradShape.width + rGradShape.width / 2 + 10;
rGradShape.y = rGradShape.height / 2;
+