/ Published in: ActionScript 3

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 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);
URL: http://www.izaias.com/tutorials/flash/drawing_triangle_fp10_example.zip
Comments
