Mega Code Archive

 
Categories / Flash ActionScript / Graphics
 

Draws a red triangle with a five pixel-thick black outline Notice that the default start point (0, 0) matches the endpoint

package{   import flash.display.*;      public class Main extends Sprite{     public function Main(){         var triangle:Shape = new Shape(  );         triangle.graphics.beginFill(0xFF0000, 1);         triangle.graphics.lineStyle(20);         triangle.graphics.lineTo(125, 125); // Draw a line down and right         triangle.graphics.lineTo(250, 0);   // Draw a line up and right         triangle.graphics.lineTo(0, 0);     // Draw a line left         triangle.graphics.endFill(  );         addChild(triangle);     }   } }