顶部468*60ad 顶部468*60ad顶部468*60ad顶部468*60ad

飘落的枫叶Flash动画的制作过程

http://www.webjx.com/  2008-06-02 23:59:30  来源:网页教学网 闪电儿

  到这时我们已经制作好了一个叶子的动作。插入一个图层,在最后帧处插入一关键帧,然后按F9打开动作面板,输入如下指令:

this.removeMovieClip ();

  如图:

  按照同样的方法另外制作两个同样的动画。在此不再详细介绍。

  最后回到场景中,插入两个新的图层,选择图层2,然后按CTRL+L打开库面板,把制作好的三个叶子飘落的动画拖到舞台中,分别选择3个叶子的动画给它们命名实例名字为leaf、leaftwo、leafthree,其中命名的方法如下图:

  选择图层3的第一帧,在此我们开始编写代码控制3个动画的飘落方法。具体代码如下:

randomTime=20
i = 1;
_root.leaf._visible = 0;
_root.leaftwo._visible = 0;
_root.leafthree._visible = 0;
_root.onEnterFrame = function () {
 if (random (20) == 0) {
  _root.leaf.duplicateMovieClip ("leaf"+i, i);
  _root["leaf"+i]._x = random (500)+200;
  _root["leaf"+i]._alpha = random (80)+20;
  _root["leaf"+i]._xscale = random (50)+50;
  _root["leaf"+i]._yscale = _root["leaf"+i]._xscale;
  i++;
 }
 if (random (20) == 0) {
  _root.leaftwo.duplicateMovieClip ("leaftwo"+i, i);
  _root["leaftwo"+i]._x = random (500)+200;
  _root["leaftwo"+i]._alpha = random (80)+20;
  _root["leaftwo"+i]._xscale = random (50)+50;
  _root["leaftwo"+i]._yscale = _root["leaftwo"+i]._xscale;
  i++;
 }
 if (random (20) == 0) {
  _root.leafthree.duplicateMovieClip ("leafthree"+i, i);
  _root["leafthree"+i]._x = random (500)+200;
  _root["leafthree"+i]._alpha = random (80)+20;
  _root["leafthree"+i]._xscale = random (50)+50;
  _root["leafthree"+i]._yscale = _root["leafthree"+i]._xscale;
  i++;
 }
};

文章评论

共有 0 位网友发表了评论 查看完整内容