您好!欢迎你光临flash聚焦的雪花制作步骤(贝贝)_贝贝动画网|Flash动画乐园!

体育

I

交友

I

论坛

I

会员注册

I

本站搜索

I

收藏本站

当前位置:首页 >>>F S教材>>>实例教材>>>flash聚焦的雪花制作步骤(贝贝)
flash聚焦的雪花制作步骤(贝贝)
发表日期:2011-7-26 12:34:00 出处:原创 作者:未知 发布人:BEIBEI666 已被访问 4197

flash聚焦的雪花制作步骤

(编写/贝贝 指导/辉煌一生)



1,打开flash界面,设置场景:550×400,背景黑色,祯频12,确定.

2,插入/新建影片元件/名字:新年快乐.A(工具),在场中打字,新年快乐.

3,插入/新建影片元件/名字:雪花.用线条工具画一个很小的白色雪花.

4,回场景1,添加2个新图层,取名字(见图一).

 图1

5,从库中拖入影片元件:新年快乐,放在场景中,选中元件,在属性面板取名字:merry1_mc

6,拖入雪花元件放在场景上面(外面), 在属性面板取名字:snow_mc.打开动作面板,输入:

  /*onClipEvent (load) {

       stage_x = 550;

       stage_y = 400;

       this.moving = true;

       touch = false;

       windx = (_parent._xmouse-stage_x/2)/100;

}

onClipEvent (mouseMove) {

       windx = (_parent._xmouse-stage_x/2)/100;

       updateAfterEvent();

}

onClipEvent (enterFrame) {

       if (this.moving) {

              //r = random(5);

              s = random(2);

              this._y += 10;

              if (s == 0) {

                     this._x += 5;

              } else if (s == 1) {

                     this._x -= 5;

              }

              this._x += windx;

              if (this._y>stage_y || this._x<0) {

                     this._y = 0;

                     this._x = random(stage_x);

              }

              this._rotation = random(180);

              if (!touch && this.hitTest(_parent.merry1_mc)) {

                     stopOrNot = random(4);

                     if (stopOrNot == 1) {

                            //this._y += random(5);

                            this.moving = false;

                            touch = true;

                            with (_parent) {

                                   createSnow();

                            }

                     }

              }

              if (this.hitTest(_parent.merry2_mc)) {

                     stopOrNot = random(2);

                     if (stopOrNot == 1) {

                            //this._y += random(5);

                            this.moving = false;

                            with (_parent) {

                                   createSnow();

                            }

                     }

              }

       }

}*/

7,action1,打开动作面板,输入:

  stop();

var i;

//产生60个小雪花

for (i=1; i<60; i++) {

       //产生新的雪花剪辑元件

       snow_mc.duplicateMovieClip("snow"+i+"_mc", i);

       //新的雪花的X,Y坐标

       eval("snow"+i+"_mc")._x = random(550);

       eval("snow"+i+"_mc")._y = random(400);

       //新的雪花的形变

       scale = random(60)+50;

       //不同的透明度,产生层次感

       eval("snow"+i+"_mc")._alpha = scale;

       //不同的大小,产生层次感

       eval("snow"+i+"_mc")._xscale = scale;

       eval("snow"+i+"_mc")._yscale = scale;

       //加入控制雪花的AS语句

       snow(eval("snow"+i+"_mc"));

}

//这个函数是用来产生一个新的雪花

function createSnow() {

       //深度递加

       i++;

       //产生实例

       snow_mc.duplicateMovieClip("snow"+i+"_mc", i);

       eval("snow"+i+"_mc")._x = random(550);

       eval("snow"+i+"_mc")._y = random(400);

       scale = random(60)+50;

       eval("snow"+i+"_mc")._alpha = scale;

       eval("snow"+i+"_mc")._xscale = scale;

       eval("snow"+i+"_mc")._yscale = scale;

       snow(eval("snow"+i+"_mc"));

}

function turnURL() {

       time--;

       time_txt.text = time;

       if (time == 0) {

              getURL("http://www.kingnare.com", "_self");

              clearInterval(intervalID);

       }

}

//var intervalID = setInterval(turnURL, 1000);

//加入控制雪花的AS语句的函数

function snow(snow_mc) {

       snow_mc.onLoad = function() {

              //舞台大小

              stage_x = 550;

              stage_y = 400;

              //用来判断是否降落

              this.moving = true;

              //判断是否接触到字体剪辑

              touch = false;

              //风向和风力

              windx = (_xmouse-stage_x/2)/100;

       };

       //风向和风力随鼠标的移动而改变

       snow_mc.onMouseMove = function() {

              windx = (_xmouse-stage_x/2)/100;

              updateAfterEvent();

       };

       snow_mc.onEnterFrame = function() {

              //判断moving

              if (this.moving) {

                     //随机数用来产生摇摆效果

                     s = random(2);

                     //雪花下落

                     this._y += 10;

                     if (s == 0) {

                            this._x += 5;

                     } else if (s == 1) {

                            this._x -= 5;

                     }

                     //加上风力

                     this._x += windx;

                     //超出舞台就初始化

                     if (this._y>stage_y || this._x<0) {

                            this._y = 0;

                            this._x = random(stage_x);

                     }

                     //产生旋转效果

                     this._rotation = random(180);

                     //未接触MERRY1_MC就执行

                     if (!touch && this.hitTest(merry1_mc)) {

                            //产生随机数用以判断是否应该停止下落

                            stopOrNot = random(4);

                            //如果随机数为1,则停止下落

                            if (stopOrNot == 1) {

                                   //this._y += random(5);

                                   //使movingfalse,停止下落

                                   this.moving = false;

                                   //因为接触了MERRY1_MC,使touchtrue

                                   touch = true;

                                   //因为停止下落,所以删除onEnterFrame

                                   delete this.onEnterFrame;

                                   //因为停止下落,所以重新再产生一个小雪花

                                   createSnow();

                            }

                     }

                     //这里和上面的一样,只不过减少了功能

                     if (this.hitTest(merry2_mc)) {

                            stopOrNot = random(2);

                            if (stopOrNot == 1) {

                                   //this._y += random(5);

                                   this.moving = false;

                                   delete this.onEnterFrame;

                                   createSnow();

                            }

                     }

              }

       };

}

fscommand("fullscreen", "true");

8,导出,测试.如果测试是全屏,Esc键就可以了.或者把最后那句fscommand("fullscreen", "true");改为fscommand("fullscreen", " false ");也是可以的,意思是:充满全屏是不真实的。

双击自动滚屏 【打印本页】 【关闭窗口
 相关评论:



时尚
(2009-11-22 7:04:00) [124.85.14.]

7,点action第1祯 是新加的图层么?这里不明白,请贝贝指教

 发表评论:共有 1 条评论

身份选择:会员 游客(游客不需要输入密码)
用 户 名: 密 码:
评论内容:
(最多评论字数:500)

琼icp备09005167号


贝贝动画网|Flash动画乐园 | 设为首页 | 加入收藏 | 联系我们 | 进入管理 | 关于站长 | 本站搜索

联系电话:13881031689 联系人:贝贝

琼icp备09005167