2 Replies Latest reply on Nov 5, 2008 12:46 AM by

    how to create a line with pointed head

      Hi,
      In my application i need to draw line with pointed head, I don't know how to define custom line with pointed head.

      Is there any solution, Please reply.

      Thank you
        • 1. Re: how to create a line with pointed head
          RUSH-ME Level 3
          Hi, add this function after drawing the line

          public function createArrow():void
          {
          var angle:Number = Math.atan2(getY2()-getY1(), getX2()-getX1());
          graphics.lineTo(getX2()-arrowHeight*Math.cos(angle)-arrowWidth*Math.sin(angle),
          getY2()-arrowHeight*Math.sin(angle)+arrowWidth*Math.cos(angle));
          graphics.lineTo(getX2(), getY2());
          graphics.lineTo(getX2()-arrowHeight*Math.cos(angle)+arrowWidth*Math.sin(angle),
          getY2()-arrowHeight*Math.sin(angle)-arrowWidth*Math.cos(angle));
          }

          getX1(), getY1(), getx2(), getY2() are the start and end points of the line

          Hope this will work for you.
          • 2. Re: how to create a line with pointed head
            It works, Thanks