Tutorial :How to add a needle or arrow from the center of pie chart using action script


alt text http://img717.imageshack.us/img717/134/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  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »