开发者

Drawing line in flash- via Action script

开发者 https://www.devze.com 2023-02-22 13:43 出处:网络
I need to draw a line in ActionScript(based on calculated conditions for length and rotation) I tried the following code- the triangle with the fill appears- but not the line with the lineStyle- Coul

I need to draw a line in ActionScript(based on calculated conditions for length and rotation)

I tried the following code- the triangle with the fill appears- but not the line with the lineStyle- Could you pls help me开发者_StackOverflow社区 out on this... c is defined as 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);       


You should declare line style before your drawing.

0

精彩评论

暂无评论...
验证码 换一张
取 消