Ok, I've got a sample script that takes a triangle, figures out what angle a
gradient should be
rotated and how wide it should be and then does a 100 to 0 alpha gradient
starting from each
corner.

The problem is I don't think I understand beginGradientFill well enough.
All I get is a solid triangle with the color of whatever corner it drew last.

If you know some about beginGradientFill() please take a look at my code:

import vector;
import point;

this.createEmptyMovieClip("tri",1);

with (tri) {
_x = Stage.width/2;
_y = Stage.height/2;

// create three points for a triangle
a = new point(0,-150);
b = new point(-150,150);
c = new point(150,150);
pts = [a,b,c]; // put points in an array so access in loop is easier
vect = []; // will hold vector from triangle point to opposite side
ang = []; // will hold the angle for rotating the gradient
colors = []; // each point will have it's own color to blend
colors[0] = [ 0xff0000, 0xff0000 ];
colors[1] = [ 0x00ff00, 0x00ff00 ];
colors[2] = [ 0x0000ff, 0x0000ff ];
alphas = [ 100, 0 ]; // want to fade to transparent
ratios = [ 0, 255 ]; // have no idea how this works (but never seen any
other values used)
M = { matrixType:"box", x:0, y:0, w:0, h:0, r:0 }; // create the matrix
(will be set in loop)

// loop through each point in the triangle
// figuring out each w and r for matrix and drawing a gradient
for (var x=0; x<pts.length; x++) {
// vector from current point to next
v1 = vector.AB(pts[(x+1)%3],pts[x]);
// vector from second point to third
v2 = vector.AB(pts[(x+2)%3],pts[(x+1)%3]);

// projection of v1 onto v2
p = v2.proj(v1);
// subtracting p from v1 gives the vector from point to opp
vect[x] = v1.minus(p);

// get the angle to use for rotating the gradient
ang[x] = Math.acos(vect[x].x/vect[x].len());
if (vect[x].y < 0) ang[x] = -ang[x]; // fix output range of acos

// setup the matrix for this gradient (this is probably where the trouble is)
M.x = pts[x].x; // gradeint starts at x,y of point
M.y = pts[x].y;
M.w = vect[x].len(); // gradient should be as wide as the distance to the
opposite side
M.r = ang[x]; // gradient should be rotated by alpha found above
beginGradientFill("linear", colors[x], alphas, ratios, M);

moveTo(pts[x].x,pts[x].y); // go to starting point
lineTo(pts[(x+1)%3].x, pts[(x+1)%3].y); // draw to next point
lineTo(pts[(x+2)%3].x, pts[(x+2)%3].y); // draw to third point
lineTo(pts[x].x,pts[x].y); // draw back to first point

endFill();

/* // uncommenting this makes it go crazy, hmmm, wonder why
lineStyle(1,colors[x][0],50);
moveTo(pts[x].x, pts[x].y);
lineTo(pts[x].x+vect[x].x, pts[x].y+vect[x].y); // */
}

// draw stroke if wanted
/*
lineStyle (2,0);
moveTo(a.x,a.y);
lineTo(b.x,b.y);
lineTo(c.x,c.y);
lineTo(a.x,a.y);
*/


}