0

大家好,我有一段用于绘制简单线条的代码,但如果可以告诉我我的错误在哪里,我将非常感谢!这是代码:

function click2(e:MouseEvent):void{
    e.currentTarget.removeEventListener(MouseEvent.CLICK, click2);
    fx=mouseX;
    fy=mouseY;
    var i:int;
    i=2;
    trace(i);
    trace(sx,sy);
    trace(fx,fy);
    var  line:Shape = new Shape();
    line.graphics.beginFill(0x0066FF);
    line.graphics.moveTo(400, 300);
    line.graphics.lineTo(400, 400);
    this.addChild(line);
}

非常感谢,我真的很感谢这个网站的社区,你们真的帮助我看到了我的错误,我m just a beginner but i做得很好只是因为你们有心!!!

4

1 回答 1

2

您正在绘制一条线,因此您必须设置lineStyle

function click2(e:MouseEvent):void {
    e.currentTarget.removeEventListener(MouseEvent.CLICK, click2);
    fx=mouseX;
    fy=mouseY;
    var i:int;
    i=2;
    trace(i);
    trace(sx,sy);
    trace(fx,fy);
    var line:Shape = new Shape();
    line.graphics.lineStyle(1, 0x0066FF, 1);
    line.graphics.moveTo(400, 300);
    line.graphics.lineTo(400, 400);
    this.addChild(line);
}
于 2013-07-31T18:29:44.257 回答