as3实用的随机改变颜色代码

作者:袖梨 2022-07-02

var dow:Boolean;
stage.addEventListener(MouseEvent.MOUSE_DOWN,down);
stage.addEventListener(MouseEvent.MOUSE_MOVE,Move);
stage.addEventListener(MouseEvent.MOUSE_UP,up);
function down(evt) {
 dow=true;
 this.graphics.lineStyle(2,rgb(),1);
 this.graphics.moveTo(mouseX,mouseY);
}
function up(evt) {
 dow=false;
}
function Move(evt) {
 if (dow) {
  this.graphics.lineTo(mouseX,mouseY);
 }
}
function rgb():uint {
 return (Math.random() * 0xffffff + 0xff000000);
}

相关文章

精彩推荐