MovieClip.prototype.draw3DPie = function(radius, yRadius, startAngle, sweepAngle, pieH, clr, pieBorderThickness, pieBorderAlpha, pieFillAlpha) { if (sweepAngle>360 || sweepAngle<-360) { sweepAngle = 360; } if (startAngle>360) { startAngle %= 360; } //If no y radius has been defined if (yRadius == undefined) { yRadius = radius; } var centerX = 0; var centerY = -pieH/2; var clr2 = getDarkColor(clr, 0.7); this.clear(); this.lineStyle(pieBorderThickness, parseInt(clr, 16), pieBorderAlpha); this.beginFill(parseInt(clr, 16), pieFillAlpha); this.moveTo(centerX, centerY); //move to center var obj = new Object(); //empty object this.drawArc(centerX, centerY, radius, yRadius, startAngle, sweepAngle, obj); this.lineTo(centerX, centerY); this.endFill(); //draw visible pie sides if any if (pieH) { this.lineStyle(pieBorderThickness, clr2, pieBorderAlpha); this.beginFill(clr2, pieFillAlpha); var mid = false; var rht = false; var lft = false; var bck = false; //draw height on bottom if (sweepAngle<360 && (obj.y1>=centerY || obj.y2>=centerY)) { if (obj.x1<=obj.x2) { if (obj.y1>=centerY && obj.y2>=centerY) { mid = true; } else if (obj.y1>=centerY) { rht = true; } else if (obj.y2>=centerY) { bck = true; } } else { if (obj.y1>centerY) { rht = true; } if (obj.y2>centerY) { lft = true; } } } else if (sweepAngle>=360 || obj.x1360) { startAngle -= 360; } //If no y radius has been defined if (yRadius == undefined) { yRadius = r; } // Same with sweepAngle if (Math.abs(sweepAngle)>360) { sweepAngle = 360; } // Flash uses 8 segments per circle, to match that, we draw in a maximum // of 45 degree segments. First we calculate how many segments are needed // for our arc. var nSubArcs = Math.floor(Math.abs(sweepAngle)/45); //After multiples of 45, we'll have some left over degs var leftoverAng = Math.abs(sweepAngle)-nSubArcs*45; //Finding the angle (radians) and its half (for control points) var ang45 = ((sweepAngle>=0) ? 45 : -45)*Math.PI/180; var ang225 = ang45/2; var cosHT = Math.cos(ang225); //Convert the offset angle to radians startAngle *= (Math.PI/180); //Get the starting position of the arc var x1 = x+Math.cos(startAngle)*r; var y1 = y-Math.sin(startAngle)*yRadius; //Draw a line from the center of the arc to the starting position this.lineTo(x1, y1); //Determine the mid angle - to calculate the control point var angleMid = startAngle-ang225; //x2 and y2 are the end points of arc //cx and cy are the control points for each arc segment var i, x2, y2, cx, cy; var rc = r/cosHT; for (i=0; i