here is the pie chart from center of that i need to draw or place needle sort of thing how to do it
views:
17answers:
1
A:
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
heavilyinvolved
2010-07-27 16:36:10
will that draw a line from the center of the chart
dpaksp
2010-07-27 16:41:57
It will draw a 400px long line from the center of the stage to (xpos, ypos) which is determined by radians.
heavilyinvolved
2010-07-27 17:05:00