How to drawing line with arrow in flex?
public function addPoint(sX:int,sY:int,eX:int,eY:int,
createArrow:Boolean):void
{
var g:Graphics =this.graphics;
g.lineStyle(1, 0xff0000, 1);
g.moveTo(sX, sY);
g.lineTo(eX, eY);
if(createArrow){// drawing arrow
g.lineStyle(6, 0x0000ff, 1);
g.moveTo(Math.round(eX+((sX-eX)/6)),
Math.round(eY+((sY-eY)/6))); // mid point
g.lineTo(eX, eY);
g.lineStyle(3, 0x00ff00, 1);
g.moveTo(Math.round(eX+((sX-eX)/6)),
Math.round(eY+((sY-eY)/6))); // mid point
g.lineTo(eX, eY);
}
}
Comments
Post a Comment