/*
mc is the movie title.
x0, y0 center coordinates; w1, w2 are the long and short axes; a0 is the starting degree, a is the end degree, h is the high, hw is the ring width, color is hexadecimal color,
movew is the movement distance, alpha is the transparency (after clicking), mcalpha is the original transparency, and movenow is to determine whether to move out when loading by default.
valuepercent is the percentage value, arr_name is each name, arr_showname determines whether the name and value are displayed,
titleline shows the length and short positions of the name and value, linecolor indicates the line color, linealpha indicates the line transparency, fontcolor text color, whether percentshow displays percentage value, dark dark coefficient (>1 such as 1.43)
This pie corresponds to the mc name of the vertically arranged square.
*/
function drawCircle(mc:MovieClip,
x0:Number, y0:Number, w1:Number, w2:Number, a0:Number, a:Number, h:Number, hw:Number, color:Number,
movew:Number, alpha:Number, mcalpha:Number, movenow:String,
valuepercent:Number, arr_name:String, arr_showname:String,
titleline:Number, linecolor:Number,linealpha:Number, fontcolor:Number,percentshow:String,dark:Number,
ordermc:MovieClip):Void {
//Additional interval
step = 1;
//Find the length and short axis of the inner
leichang = w1-hw;
leiduan = w2-(hw*w2/w1);
//Dark
hicolor = darkcolor(color,dark);
//---------------------------------
//The lower ring is the lower ring;
(color, 100);
//(1, color, 100, false, "none");
//Outside
(getPoint(x0, y0+h, w1, w2, a0).x, getPoint(x0, y0+h, w1, w2, a0).y);
k = a0;
while (k<a) {
k += step;
(getPoint(x0, y0+h, w1, w2, k).x, getPoint(x0, y0+h, w1, w2, k).y);
}
//Side 1
(getPoint(x0, y0+h, leichang, leiduan, k).x, getPoint(x0, y0+h, leichang, leiduan, k).y);
//Inner side
while (k>a0) {
k -= step;
(getPoint(x0, y0+h, leichang, leiduan, k).x, getPoint(x0, y0+h, leichang, leiduan, k).y);
}
//Side 2
(getPoint(x0, y0+h, leichang, leiduan, a0).x, getPoint(x0, y0+h, leichang, leiduan, a0).y);
();
//--------------------------------
//High down
//The lower side is high
if(a0<=0 && a>=0 && a<=180){
//Solve the outer side when 90 degrees, the fact is 90 degrees, and the actual number is 0 degrees, because we rotated the entirely -90 degrees;
(hicolor, 100);
(getPoint(x0, y0+h, w1, w2, a0).x, getPoint(x0, y0+h, w1, w2, a0).y);
k=a0;
while (k<0) {
k += step;
(getPoint(x0, y0+h, w1, w2, k).x, getPoint(x0, y0+h, w1, w2, k).y);
}
(getPoint(x0, y0, w1, w2, 0).x, getPoint(x0, y0, w1, w2, 0).y);
while (k>a0){
k -=step;
(getPoint(x0, y0, w1, w2, k).x, getPoint(x0, y0, w1, w2, k).y);
}
();
(hicolor, 100);
(getPoint(x0, y0+h, w1, w2, 0).x, getPoint(x0, y0+h, w1, w2, 0).y);
k=0;
while (k<a) {
k += step;
(getPoint(x0, y0+h, w1, w2, k).x, getPoint(x0, y0+h, w1, w2, k).y);
}
(getPoint(x0, y0, w1, w2, a).x, getPoint(x0, y0, w1, w2, a).y);
while (k>0){
k -=step;
(getPoint(x0, y0, w1, w2, k).x, getPoint(x0, y0, w1, w2, k).y);
}
();
}else if(a>=180 && a0<=180 && a0>=0){
//Solve the outer side when 180 degrees, the fact is 270 degrees, and the actual number is 180 degrees, because we rotated the entirely -90 degrees;
(hicolor, 100);
(getPoint(x0, y0+h, w1, w2, a0).x, getPoint(x0, y0+h, w1, w2, a0).y);
k=a0;
while (k<180) {
k += step;
(getPoint(x0, y0+h, w1, w2, k).x, getPoint(x0, y0+h, w1, w2, k).y);
}
(getPoint(x0, y0, w1, w2, 180).x, getPoint(x0, y0, w1, w2, 180).y);
while (k>a0){
k -=step;
(getPoint(x0, y0, w1, w2, k).x, getPoint(x0, y0, w1, w2, k).y);
}
();
(hicolor, 100);
(getPoint(x0, y0+h, w1, w2, 180).x, getPoint(x0, y0+h, w1, w2, 180).y);
k=180;
while (k<a) {
k += step;
(getPoint(x0, y0+h, w1, w2, k).x, getPoint(x0, y0+h, w1, w2, k).y);
}
(getPoint(x0, y0, w1, w2, a).x, getPoint(x0, y0, w1, w2, a).y);
while (k>180){
k -=step;
(getPoint(x0, y0, w1, w2, k).x, getPoint(x0, y0, w1, w2, k).y);
}
();
}else if(a0<=0 && a>=180){
//Solve the situation where it is at 0 degrees and 180 degrees at the same time
(hicolor, 100);
(getPoint(x0, y0+h, w1, w2, a0).x, getPoint(x0, y0+h, w1, w2, a0).y);
k=a0;
while (k<0) {
k += step;
(getPoint(x0, y0+h, w1, w2, k).x, getPoint(x0, y0+h, w1, w2, k).y);
}
(getPoint(x0, y0, w1, w2, 0).x, getPoint(x0, y0, w1, w2, 0).y);
while (k>a0){
k -=step;
(getPoint(x0, y0, w1, w2, k).x, getPoint(x0, y0, w1, w2, k).y);
}
();
(hicolor, 100);
(getPoint(x0, y0+h, w1, w2, 0).x, getPoint(x0, y0+h, w1, w2, 0).y);
k=0;
while (k<180) {
k += step;
(getPoint(x0, y0+h, w1, w2, k).x, getPoint(x0, y0+h, w1, w2, k).y);
}
(getPoint(x0, y0, w1, w2, 180).x, getPoint(x0, y0, w1, w2, 180).y);
while (k>0){
k -=step;
(getPoint(x0, y0, w1, w2, k).x, getPoint(x0, y0, w1, w2, k).y);
}
();
(hicolor, 100);
(getPoint(x0, y0+h, w1, w2, 180).x, getPoint(x0, y0+h, w1, w2, 180).y);
k=180;
while (k<a) {
k += step;
(getPoint(x0, y0+h, w1, w2, k).x, getPoint(x0, y0+h, w1, w2, k).y);
}
(getPoint(x0, y0, w1, w2, a).x, getPoint(x0, y0, w1, w2, a).y);
while (k>180){
k -=step;
(getPoint(x0, y0, w1, w2, k).x, getPoint(x0, y0, w1, w2, k).y);
}
();
}else{
(hicolor, 100);
(getPoint(x0, y0+h, w1, w2, a0).x, getPoint(x0, y0+h, w1, w2, a0).y);
k = a0;
while (k<a) {
k += step;
(getPoint(x0, y0+h, w1, w2, k).x, getPoint(x0, y0+h, w1, w2, k).y);
}
//(getPoint(x0, y0+h, w1, w2, a).x, getPoint(x0, y0+h, w1, w2, a).y);
(getPoint(x0, y0, w1, w2, k).x, getPoint(x0, y0, w1, w2, k).y);
while (k>a0) {
k -= step;
(getPoint(x0, y0, w1, w2, k).x, getPoint(x0, y0, w1, w2, k).y);
}
();
}
//The bottom starts to have a side height
(hicolor, 100);
//(1, hicolor, 100, false, "none");
(getPoint(x0, y0+h, w1, w2, a0).x, getPoint(x0, y0+h, w1, w2, a0).y);
(getPoint(x0, y0+h, leichang, leiduan, a0).x, getPoint(x0, y0+h, leichang, leiduan, a0).y);
(getPoint(x0, y0, leichang, leiduan, a0).x, getPoint(x0, y0, leichang, leiduan, a0).y);
(getPoint(x0, y0, w1, w2, a0).x, getPoint(x0, y0, w1, w2, a0).y);
();
//The end side height below
(hicolor, 100);
//(1, hicolor, 100, false, "none");
(getPoint(x0, y0+h, w1, w2, a).x, getPoint(x0, y0+h, w1, w2, a).y);
(getPoint(x0, y0+h, leichang, leiduan, a).x, getPoint(x0, y0+h, leichang, leiduan, a).y);
(getPoint(x0, y0, leichang, leiduan, a).x, getPoint(x0, y0, leichang, leiduan, a).y);
(getPoint(x0, y0, w1, w2, a).x, getPoint(x0, y0, w1, w2, a).y);
();
//High inside
(hicolor, 100);
//(1, hicolor, 100, false, "none");
(getPoint(x0, y0+h, leichang, leiduan, a0).x, getPoint(x0, y0+h, leichang, leiduan, a0).y);
k = a0;
while (k<a) {
k += step;
(getPoint(x0, y0+h, leichang, leiduan, k).x, getPoint(x0, y0+h, leichang, leiduan, k).y);
}
(getPoint(x0, y0, leichang, leiduan, k).x, getPoint(x0, y0, leichang, leiduan, k).y);
while (k>a0) {
k -= step;
(getPoint(x0, y0, leichang, leiduan, k).x, getPoint(x0, y0, leichang, leiduan, k).y);
}
();
//---------------------------------
//The lower part is the upper ring;
(color, 100);
//(1, color, 100, false, "none");
//Outside
(getPoint(x0, y0, w1, w2, a0).x, getPoint(x0, y0, w1, w2, a0).y);
k = a0;
while (k<a) {
k += step;
(getPoint(x0, y0, w1, w2, k).x, getPoint(x0, y0, w1, w2, k).y);
}
//Side 1
(getPoint(x0, y0, leichang, leiduan, k).x, getPoint(x0, y0, leichang, leiduan, k).y);
//Inner side
while (k>a0) {
k -= step;
(getPoint(x0, y0, leichang, leiduan, k).x, getPoint(x0, y0, leichang, leiduan, k).y);
}
//Side 2
(getPoint(x0, y0, leichang, leiduan, a0).x, getPoint(x0, y0, leichang, leiduan, a0).y);
();
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
if(arr_showname=="true"){
(color, 100);
(1, linecolor, linealpha);
(getPoint(x0, y0, w1, w2, a0+(a-a0)/2).x,getPoint(x0, y0, w1, w2, a0+(a-a0)/2).y);
(getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).x,getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).y);
();
//trace(mc._name+":"+(a0+(a-a0)/2));
if(a0+(a-a0)/2>0 && a0+(a-a0)/2<90){
var label:TextField = ("label", 1, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).x, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).y, 0, 0);
= "left";
}else if(a0+(a-a0)/2>90 && a0+(a-a0)/2<180){
var label:TextField = ("label", 1, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).x, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).y, 0, 0);
= "right";
}else if(a0+(a-a0)/2>180 && a0+(a-a0)/2<270){
var label:TextField = ("label", 1, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).x, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).y-18, 0, 0);
= "right";
}else if(a0+(a-a0)/2>-90 && a0+(a-a0)/2<0){
var label:TextField = ("label", 1, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).x, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).y-18, 0, 0);
= "left";
}else if(a0+(a-a0)/2==0){
var label:TextField = ("label", 1, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).x, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).y-9, 0, 0);
= "left";
}else if(a0+(a-a0)/2==90){
var label:TextField = ("label", 1, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).x, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).y, 0, 0);
= "center";
}else if(a0+(a-a0)/2==180){
var label:TextField = ("label", 1, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).x, getPoint(x0, y0, w1+titleline, w2+(w2*titleline)/w1, a0+(a-a0)/2).y-9, 0, 0);
= "right";
}
= true;
if(percentshow=="all"){
= arr_name+":"+valuepercent+"%";
}else if(percentshow=="font"){
= arr_name;
}else if(percentshow=="num"){
= valuepercent+"%";
}
var myformat:TextFormat = new TextFormat();
= "Verdana";
= 12;
= fontcolor;
(myformat);
= "pixel";
= "advanced";
= -400;
}
//--------------------------------------
//Click to move
= function(){
//Movement direction: Degree:
go_a = a0+(a-a0)/2;
//Moving distance
go_w = movew;
//trace(this._name);
//trace();
if(mc._x!=0 || mc._y!=0){
myTweeen3=new Tween(mc,"_x",,mc._x,(mc._x - (getPoint(x0,y0,go_w,go_w,go_a).x-x0)),1.5,true);
myTweeen4=new Tween(mc,"_y",,mc._y,(mc._x - (getPoint(x0,y0,go_w,go_w,go_a).x-x0)),1.5,true);
//Transparency
myTweeenalpha2=new Tween(mc,"_alpha",,mc._alpha,mcalpha,1,true);
var listener3:Object = new Object();
= false;
= false;//Arrange the squares corresponding to this pie vertically
= function(){
= true;
= true;//Arrange the squares corresponding to this pie mc vertically
}
(listener3);
//mc._x = mc._x - (getPoint(x0,y0,go_w,go_w,go_a).x-x0);
//mc._y = mc._y - (getPoint(x0,y0,go_w,go_w,go_a).y-y0);
}else{
//Arrival at the new point
myTweeen1=new Tween(mc,"_x",,mc._x,(getPoint(x0,y0,go_w,go_w,go_a).x-x0),1,true);
myTweeen2=new Tween(mc,"_y",,mc._y,(getPoint(x0,y0,go_w,go_w,go_a).y-y0),1,true);
//Transparency
myTweeenalpha=new Tween(mc,"_alpha",,mc._alpha,alpha,1,true);
var listener1:Object = new Object();
= false;
= false;//Arrange the squares corresponding to this pie vertically
= function(){
= true;
= true;//Arrange the squares corresponding to this pie mc vertically
}
(listener1);
}
//trace(());
}
//Default location (mobile)
if(movenow=="true"){
//Movement direction: Degree:
go_a = a0+(a-a0)/2;
//Moving distance
go_w = movew;
myTweeen5=new Tween(mc,"_x",,mc._x,(getPoint(x0,y0,go_w,go_w,go_a).x-x0),1,true);
myTweeen6=new Tween(mc,"_y",,mc._y,(getPoint(x0,y0,go_w,go_w,go_a).y-y0),1,true);
//Transparency
myTweeenalpha=new Tween(mc,"_alpha",,mc._alpha,alpha,1,true);
var listener5:Object = new Object();
= false;
= false;//Arrange the squares corresponding to this pie vertically
= function(){
= true;
= true;//Arrange the squares corresponding to this pie vertically
}
(listener5);
}
}
/*--------------------------------------------------------------------------------------------
x=a*cosX //x and y are the coordinates of a point on the ellipse; a and b are the long and short axes respectively
y=b*sinX//X is the angle of the rotation of the ellipse.
Calculate the position function of the point on the ellipse, x0 and y0 are the center of the circle; w and h are the long and short axis; a is the degree. Returns a coordinate object with two attributes: x and y.
*/
function getPoint(x0:Number, y0:Number, w:Number, h:Number, a:Number):Object {
a = a*/180;
return {x:(a)*w+x0, y:(a)*h+y0};
}
//--------------------------------------------------------------------------------------
/*--------------------------------------------------------------------------------------------
Deeper the color
The original color oldcolor is a hexadecimal notation such as: 0xff6600; returns a value of the same type.
*/
function darkcolor(oldcolor:Number,dark:Number):Number{
//Please dark colors
if((16).length<6){//Prevent the first bit of this hexadecimal number from 0;
r = parseInt("0x0"+substring((16), 0, 1));
g = parseInt("0x"+substring((16), 2, 2));
b = parseInt("0x"+substring((16), 4, 2));
}else{
r = parseInt("0x"+substring((16), 0, 2));
g = parseInt("0x"+substring((16), 3, 2));
b = parseInt("0x"+substring((16), 5, 2));
}
//trace("original rgb:"+r+":"+g+":"+b);
//dark = 1.43;
r=(r/dark).toString(16);
g=(g/dark).toString(16);
b=(b/dark).toString(16);
//trace("new rgb:"+r+":"+g+":"+b);
==1 ? r="0"+r:r;
==1 ? g="0"+g:g;
==1 ? b="0"+b:b;
var hicolor:Number;
hicolor = parseInt("0x"+(16)+""+(16)+""+(16));
r = parseInt("0x"+substring((16), 0, 2));
g = parseInt("0x"+substring((16), 3, 2));
b = parseInt("0x"+substring((16), 5, 2));
return hicolor;
}