function createCircle(x1,y1,r1,borderSize1,borderColor1,bgColor1){
var mc1:Shape = new Shape();
mc1.graphics.lineStyle(borderSize1,borderColor1);
mc1.graphics.beginFill(bgColor1);
mc1.graphics.drawCircle(x1,y1,r1);
mc1.graphics.endFill();
addChild(mc1);
}
function createEllipse(x2,y2,w2,h2,borderSize2,borderColor2,bgColor2){
var mc2:Shape = new Shape();
mc2.graphics.lineStyle(borderSize2,borderColor2);
mc2.graphics.beginFill(bgColor2);
mc2.graphics.drawEllipse(x2,y2,w2,h2);
mc2.graphics.endFill();
addChild(mc2);
}
createCircle(100,150,50,2,0x000000,0xFFCC00);
createEllipse(240,110,120,80,2,0x000000,0xFFCC00);
好簡單喔 T_T .. 圓的定位點在圓心,橢圓定位點和矩形相同,都在左上角。endFill()封閉路徑並填滿顏色,在這裡非必要,也是寫繪圖程式的好習慣。 var mc1:Shape = new Shape();
mc1.graphics.lineStyle(borderSize1,borderColor1);
mc1.graphics.beginFill(bgColor1);
mc1.graphics.drawCircle(x1,y1,r1);
mc1.graphics.endFill();
addChild(mc1);
}
function createEllipse(x2,y2,w2,h2,borderSize2,borderColor2,bgColor2){
var mc2:Shape = new Shape();
mc2.graphics.lineStyle(borderSize2,borderColor2);
mc2.graphics.beginFill(bgColor2);
mc2.graphics.drawEllipse(x2,y2,w2,h2);
mc2.graphics.endFill();
addChild(mc2);
}
createCircle(100,150,50,2,0x000000,0xFFCC00);
createEllipse(240,110,120,80,2,0x000000,0xFFCC00);
| 2007/08/10 11:13 |
Trackback Address :: http://blog.raienet.com/trackback/355
