小刀模仿屏幕保护

      Flash学习 2006-5-22 23:23
小刀模仿屏幕保护

Flash 动画


=================================
把代码复制到frame中就行了
var a:MovieClip=_root.createEmptyMovieClip("a",_root.getNextHighestDepth());
//var t:MovieClip=_root.createEmptyMovieClip("t",_root.getNextHighestDepth());
var n=6;
for(var i=0;i<n;i++){
  var b:MovieClip=a.createEmptyMovieClip("b"+i,i);
  b.xd=Math.random()*30-15;
  b.yd=Math.random()*30-15;
  b.onEnterFrame=m;
  }
function m(){
  this._x+=this.xd;
  this._y+=this.yd;
  if(this._x<0||this._x>Stage.width)this.xd*=-1;
  if(this._y<0||this._y>Stage.height)this.yd*=-1;
  }
line=function(){
  a.clear();
  a.lineStyle(0.5,Math.random()*0xfffff,100);
  a.moveTo(a.b0._x,a.b0._y);
  for(var i=1;i<n;i++){
    a.lineTo(a["b"+i]._x,a["b"+i]._y);
    }
  a.lineTo(a.b0._x,a.b0._y);
  //updateAfterEvent();
  }
var id=setInterval(line,50);
标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}