我需要在ActionScript中绘制一条线(基于计算的长度和旋转条件)
我尝试了以下代码 - 显示填充的三角形 - 但不是lineStyle的行 - 你能不能帮我解决这个问题... c被定义为UIComponent
var myShape:Shape=new Shape();
myShape.graphics.moveTo(100,100);
myShape.graphics.lineTo(200,200);
myShape.graphics.lineStyle(2,0xFF0000,.75);
c.addChild(myShape);
var triangleHeight:uint = 100;
var triangle:Shape = new Shape();
// red triangle
triangle.graphics.beginFill(0xFF0000);
triangle.graphics.moveTo(triangleHeight/2, 200);
triangle.graphics.lineTo(triangleHeight, triangleHeight);
triangle.graphics.lineTo(0, triangleHeight);
triangle.graphics.lineTo(triangleHeight/2, 200);
c.addChild(triangle);
答案 0 :(得分:1)
您应该在绘图之前声明线条样式。