Return to Snippet

Revision: 24936
at March 16, 2010 10:13 by izaiasdotcom


Initial Code
// set the vertices as points
var point1:Point = new Point(0, 0);
var point2:Point = new Point(100, 0);
var point3:Point = new Point(0, 100);

// translate it into actual verticies
var vertices:Vector.<Number> = Vector.<Number>([point1.x, point1.y, point2.x, point2.y, point3.x, point3.y]);

// make a new display object - where the triangle will be drawn
var triangle:Sprite = new Sprite();

// draw
triangle.graphics.beginFill(0x00ff00, 1);
triangle.graphics.drawTriangles(vertices);
triangle.graphics.endFill();

// add it to the display list
addChild(triangle);

Initial URL
http://www.izaias.com/tutorials/flash/drawing_triangle_fp10_example.zip

Initial Description

                                

Initial Title
Drawing triangles in FP10

Initial Tags
api

Initial Language
ActionScript 3