Draws a red triangle with a five pixel-thick black outline. Notice that the default start point (0, 0) matches the endpoint : Triangle « Graphics « Flash / Flex / ActionScript






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);

    }
  }
}

        








Related examples in the same category

1.Creates the triangle
2.Registers mouseMoveListener( ) to be executed whenever the mouse moves while the mouse pointer is over the Sprite object referenced by the variable triangle.
3.MouseEvent.MOUSE_MOVE: Handling MouseEvent.MOUSE_MOVE over a triangle