alt text http://img717.imageshack.us/img717/13开发者_StackOverflow中文版4/piekh.png
Here is the pie chart from center of what I need to draw or place needle sort of thing. How to do it?
Something like the following should work:
var radians:Number = Math.PI;
var radius:Number = 400;
var xpos:Number = Math.sin(radians)*radius;
var ypos:Number = Math.cos(radians)*radius;
var line:Shape = new Shape();
line.x = stage.stageWidth*0.5;
line.y = stage.stageHeight*0.5;
addChild(line);
var g:Graphics = line.graphics;
g.clear();
g.lineStyle(2, 0x000000);
g.lineTo(xpos, ypos);
If you need to convert degrees to radians or radians to degrees you can use:
degrees to radians: (degrees * Math.PI) / 180
radians to degrees: (radians * 180) / Math.PI
精彩评论