设为首页 加入收藏 网站搜索 繁體中文 中国建站网 — 站长资源分享平台

鼠标跟随

来源:136z.Com 作者:佚名 时间:2005-07-05 00:14:06

先看效果
点击浏览该文件


http://www.Flash8.net/bbs/UploadFile/2005-6/200562412045497.swf

因为全是as编写的,所以我就不放源文件了,只要把as代码复制到Flash里的第一帧就可以了

Stage.scaleMode = "noScale"
Stage.align = "TL"
for (i=1; i<=4; i++) {
_root.createEmptyMovieClip("point"+i, 0-i);//新建MC
//mc的x轴,y轴
_root["point"+i]._x = Stage.width/2;
_root["point"+i]._y = Stage.height/2;
//鼠标划过的效果
_root["point"+i].onMouseMove = function() {
this._x = _root._xmouse+(Math.random()*70)-35;
this._y = _root._ymouse+(Math.random()*70)-35;
};
}
//设定一个颜色组
hexColors = new Array("0xCC00FF", "0xCC33FF", "0xCC66FF", "0xCC99FF", "0xCCCCFF", "0xCCFFFF");
//鼠标划过时新建mc,并随机填充颜色和随机设alpha值
this.onMouseMove = function() {
i++;
this.createEmptyMovieClip("shape"+i, i *10);
with (this["shape"+i]) {
beginFill(hexColors[Math.floor(Math.random()*hexColors.length)], (Math.random()*40)+60);
//执行画线程序
moveTo(_root.point1._x, _root.point1._y);
curveTo(_root.point2._x, _root.point2._y, _root.point3._x, _root.point3._y);
curveTo(_root.point4._x, _root.point4._y, _root.point1._x, _root.point1._y);
endFill();
}
//复制当前mc,设X,Y轴,alpha值,并填充颜色,做为阴影。
this["shape"+i].duplicateMovieClip("shadow"+i, (10*i)-1);
this["shadow"+i]._x = this["shape"+i]._x -6;
this["shadow"+i]._y = this["shape"+i]._y + 6;
this["shadow"+i]._alpha = 60;
this.grey = new Color(this["shadow"+i]);
this.grey.setRGB("0x999999");
};只做了简单的解释,适合有as基础的朋友学习
Stage.scaleMode="noScale";
Stage.align="TL";


for(i=1;i<=4;i++){
_root.createEmptyMovieClip("point"+i,0-i);
//新建MC
//mc的x轴,y轴
_root["point"+i]._x=Stage.width/2;
_root["point"+i]._y=Stage.height/2;
//鼠标划过的效果
_root["point"+i].onMouseMove=function(){
this._x=_root._xmouse+(Math.random()*70)-35;
this._y=_root._ymouse+(Math.random()*70)-35;
};
}
//设定一个颜色组
hexColors=newArray("0xCC00FF","0xCC33FF","0xCC66FF","0xCC99FF","0xCCCCFF","0xCCFFFF");
//鼠标划过时新建mc,并随机填充颜色和随机设alpha值
this.onMouseMove=function(){
i++;
this.createEmptyMovieClip("shape"+i,i*10);
with(this["shape"+i]){
beginFill(hexColors[Math.floor(Math.random()*hexColors.length)],(Math.random()*40)+60);
//执行画线程序
moveTo(_root.point1._x,_root.point1._y);
curveTo(_root.point2._x,_root.point2._y,_root.point3._x,_root.point3._y);
curveTo(_root.point4._x,_root.point4._y,_root.point1._x,_root.point1._y);
endFill();
}
//复制当前mc,设X,Y轴,alpha值,并填充颜色,做为阴影。
this["shape"+i].duplicateMovieClip("shadow"+i,(10*i)-1);
this["shadow"+i]._x=this["shape"+i]._x-6;
this["shadow"+i]._y=this["shape"+i]._y+6;
this["shadow"+i]._alpha=60;
this.grey=newColor(this["shadow"+i]);
this.grey.setRGB("0x999999");
};
//加了一段删除的
varii:Number=6;
functiondel(){
if(_root["shape"+ii]){
_root["shape"+ii].removeMovieClip();
_root["shadow"+ii].removeMovieClip();
ii++;
}
}
setInterval(del,10);

点击浏览该文件
http://www.Flash8.net/bbs/UploadFile/2005-6/200562418334546.swf

Tags:

  • 好的评价 如果您觉得好,就请您
      0%(0)
  • 差的评价 如果您觉得差,就请您
      0%(0)
  • 相关文章
    广告赞助

    文章随便看看 设计素材 建站学院 网页模板 视频教程

    网友评论

    共有 0 位网友发表了评论,得分 0 分,平均 0 分    查看完整评论

    用户名: 查看更多评论

    分 值:100分 85分 70分 55分 40分 25分 10分 1分

    内 容:

             通知管理员 验证码: