MovieClip.prototype.drawRegAng = function(x, y, r, num, rotation) { /*参数说明:x,y:多边形的中央坐标;r:多边形半径;num:多边形边数;最后一个是旋转角度*/ var tAngle = (rotation-90)*Math.PI/180; var angle = 2*Math.PI/num; var sin = Math.sin; var cos = Math.cos; num++; this.moveTo(x+r*cos(tAngle), y+r*sin(tAngle)); while (num--) { tAngle += angle; this.lineTo(x+r*cos(tAngle), y+r*sin(tAngle)); } }; this.createEmptyMovieClip("loader", 100); loader.lineStyle(0, 0x000000); //初始化变量 var r=50,num=5,rota=0; var x = Stage.width/2, y = Stage.height/2; loader.drawRegAng(x, y, r, num, rota);