diff options
Diffstat (limited to 'libs/open-flash-chart/actionscript/prototype.fillCircle.as')
-rw-r--r-- | libs/open-flash-chart/actionscript/prototype.fillCircle.as | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libs/open-flash-chart/actionscript/prototype.fillCircle.as b/libs/open-flash-chart/actionscript/prototype.fillCircle.as new file mode 100644 index 0000000000..14db8e38d0 --- /dev/null +++ b/libs/open-flash-chart/actionscript/prototype.fillCircle.as @@ -0,0 +1,22 @@ +MovieClip.prototype.fillCircle = function(x, y, radius, accuracy, colour:Number )
+{
+ if (a < 3) a = 3;
+ var span = Math.PI/accuracy;
+ var controlRadius = radius/Math.cos(span);
+ var anchorAngle=0, controlAngle=0;
+ this.moveTo(x+Math.cos(anchorAngle)*radius, y+Math.sin(anchorAngle)*radius);
+
+ this.beginFill( colour, 100 );
+ for (var i=0; i<accuracy; ++i)
+ {
+ controlAngle = anchorAngle+span;
+ anchorAngle = controlAngle+span;
+ this.curveTo(
+ x + Math.cos(controlAngle)*controlRadius,
+ y + Math.sin(controlAngle)*controlRadius,
+ x + Math.cos(anchorAngle)*radius,
+ y + Math.sin(anchorAngle)*radius
+ );
+ }
+ this.endFill();
+}
\ No newline at end of file |