PDA

View Full Version : Help: How to draw / fill shapes using AS


Selrahc
06-08-2002, 08:54 PM
Hi all! Need a little help.....

I need to be able to draw a hexagon and fill it using actionscript and coordinates. I want to be able to alter the location of the corners of the shape to warp it when buttons are pressed...

Can anyone please tell me how to draw and fill a shape using actionscript? I think idealy I would like to assign each corner as a variable and store the coordinates in the variable....

Thanks in advance!!!!!:)

Abelius
06-08-2002, 11:24 PM
Oh, that's aactually a very cool feature of Actionscript I promised myself to learn one day... But if you have Flash MX, then you can check out the Reference...

And here is an example, taken out of there. Long live Macromedia!


The following example uses a beginGradientFill method with a matrix parameter that is an object with these properties.


_root.createEmptyMovieClip( "grad", 1 );
with ( _root.grad )

{

colors = [ 0xFF0000, 0x0000FF ];
alphas = [ 100, 100 ];
ratios = [ 0, 0xFF ];
matrix = { a:200, b:0, c:0, d:0, e:200, f:0, g:200, h:200, i:1 };
beginGradientFill( "linear", colors, alphas, ratios, matrix );
moveto(100,100);
lineto(100,300);
lineto(300,300);
lineto(300,100);
lineto(100,100);
endFill();

}