画扇形
import flash.display.MovieClip;
import flash.display.Sprite;
var stag:Sprite=new Sprite();
addChild(stag);
var moviec:MovieClip = new MovieClip ;
stag.addChild(moviec);
var S_angle:int = 60;
DrawSector(moviec,200,200,100,S_angle,270,0xffcc00);
function DrawSector(mc:MovieClip,x:Number=200,y:Number=200,r:Number=100,
angle:Number=27,startFrom:Number=270,color:Number=0xff0000):void
{
mc.graphics.beginFill(color,50);
mc.graphics.lineStyle(0,0xff0000);
mc.graphics.moveTo(x,y);
angle=(Math.abs(angle)>360)?360:angle;
var n:Number = Math.ceil(Math.abs(angle) / 45);
var angleA:Number = angle / n;
angleA = angleA * Math.PI / 180;
startFrom = startFrom * Math.PI / 180;
mc.graphics.lineTo(x+r*Math.cos(startFrom),y+r*Math.sin(startFrom));
for (var i=1; i<=n; i++)
{
startFrom += angleA;
var angleMid = startFrom - angleA / 2;
var bx = x + r / Math.cos(angleA / 2) * Math.cos(angleMid);
var by = y + r / Math.cos(angleA / 2) * Math.sin(angleMid);
var cx = x + r * Math.cos(startFrom);
var cy = y + r * Math.sin(startFrom);
mc.graphics.curveTo(bx,by,cx,cy);
}
if (angle != 360)
{
mc.graphics.lineTo(x,y);
}
mc.graphics.endFill();
}
import flash.display.Sprite;
var stag:Sprite=new Sprite();
addChild(stag);
var moviec:MovieClip = new MovieClip ;
stag.addChild(moviec);
var S_angle:int = 60;
DrawSector(moviec,200,200,100,S_angle,270,0xffcc00);
function DrawSector(mc:MovieClip,x:Number=200,y:Number=200,r:Number=100,
angle:Number=27,startFrom:Number=270,color:Number=0xff0000):void
{
mc.graphics.beginFill(color,50);
mc.graphics.lineStyle(0,0xff0000);
mc.graphics.moveTo(x,y);
angle=(Math.abs(angle)>360)?360:angle;
var n:Number = Math.ceil(Math.abs(angle) / 45);
var angleA:Number = angle / n;
angleA = angleA * Math.PI / 180;
startFrom = startFrom * Math.PI / 180;
mc.graphics.lineTo(x+r*Math.cos(startFrom),y+r*Math.sin(startFrom));
for (var i=1; i<=n; i++)
{
startFrom += angleA;
var angleMid = startFrom - angleA / 2;
var bx = x + r / Math.cos(angleA / 2) * Math.cos(angleMid);
var by = y + r / Math.cos(angleA / 2) * Math.sin(angleMid);
var cx = x + r * Math.cos(startFrom);
var cy = y + r * Math.sin(startFrom);
mc.graphics.curveTo(bx,by,cx,cy);
}
if (angle != 360)
{
mc.graphics.lineTo(x,y);
}
mc.graphics.endFill();
}