492 Chapter 12: ActionScript Dictionary
Returns
Nothing.
Description
Method; indicates the beginning of a new drawing path. If the first parameter is undefined, or if
no parameters are passed, the path has no fill. If an open path exists (that is if the current drawing
position does not equal the previous position specified in a
moveTo() method), and it has a fill
associated with it, that path is closed with a line and then filled. This is similar to what happens
when you call
endFill().
This method fails if any of the following conditions exist:
• The number of items in the colors, alphas, and ratios parameters are not equal.
• The fillType parameter is not “linear” or “radial”.
• Any of the fields in the object for the matrix parameter are missing or invalid.
Example
The following code uses both methods to draw two stacked rectangles with a red-blue gradient fill
and a 5-pt. solid green stroke.
_root.createEmptyMovieClip("goober",1);
with ( _root.goober )
{
colors = [ 0xFF0000, 0x0000FF ];
alphas = [ 100, 100 ];
ratios = [ 0, 0xFF ];
lineStyle( 5, 0x00ff00 );
matrix = { a:500,b:0,c:0,d:0,e:200,f:0,g:350,h:200,i:1};
beginGradientFill( "linear", colors, alphas, ratios, matrix );
moveto(100,100);
lineto(100,300);
lineto(600,300);
lineto(600,100);
lineto(100,100);
endFill();
matrix = { matrixType:"box", x:100, y:310, w:500, h:200, r:(0/180)*Math.PI
};
beginGradientFill( "linear", colors, alphas, ratios, matrix );
moveto(100,310);
lineto(100,510);
lineto(600,510);
lineto(600,310);
lineto(100,310);
endFill();
}