Posted By

izaiasdotcom on 03/16/10


Tagged

api triangle Drawing fp10


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

scottwatkins


Drawing triangles in FP10


 / Published in: ActionScript 3
 

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

  1. // set the vertices as points
  2. var point1:Point = new Point(0, 0);
  3. var point2:Point = new Point(100, 0);
  4. var point3:Point = new Point(0, 100);
  5.  
  6. // translate it into actual verticies
  7. var vertices:Vector.<Number> = Vector.<Number>([point1.x, point1.y, point2.x, point2.y, point3.x, point3.y]);
  8.  
  9. // make a new display object - where the triangle will be drawn
  10. var triangle:Sprite = new Sprite();
  11.  
  12. // draw
  13. triangle.graphics.beginFill(0x00ff00, 1);
  14. triangle.graphics.drawTriangles(vertices);
  15. triangle.graphics.endFill();
  16.  
  17. // add it to the display list
  18. addChild(triangle);

Report this snippet  

You need to login to post a comment.