一、画直线
graphics.clear(); //删除绘制
graphics.lineStyle(1, 0, 1); //参数1:线条宽度;参数2:线条颜色;参数3:线条透明度(0.0---1.0)
graphics.moveTo(100, 100); //x,y.为线条设置一个新的起始坐标点
graphics.lineTo(100, 200); //x,y,如果不移动起始点,将从0,0坐标开始绘制
二、画圆
graphics.beginFill(color);
//
color:填充颜色|透明度
graphics.drawCircle( 100 , 100 ,radius); // radius:半径
graphics.endFill(); //结束绘制
graphics.drawCircle( 100 , 100 ,radius); // radius:半径
graphics.endFill(); //结束绘制
三、画四边行
graphics.beginFill(color);
//
填充颜色
graphics.drawRect( 100 , 100 , 100 , 100 ); // top,left,width,height
graphics.endFill();
graphics.drawRect( 100 , 100 , 100 , 100 ); // top,left,width,height
graphics.endFill();