5. 分别点选“脚本”层中的第1、2、51帧,按F7键插入空白关键帧。
第1帧中的代码如下:
// 改变元件的大小和位置
n = Math.random()*80+40;
this._xscale = n;
this._yscale = n;
this._x = 200;
this._y = Math.random()*250+50;
// 跳转到该元件的某一帧
startframe = Math.round(Math.random()*50);
gotoAndPlay(startframe);
第2帧中的代码为播放动画命令:
play ();
第51帧中为跳转命令:
gotoAndPlay (2);
6. 回到主场景,同样新建一个“脚本”层和“元件”层。按快捷键Ctrl+L打开“库”面板,把“泡泡动画”元件拖到“元件”层中。点选场景中的“泡泡动画”元件,在“属性”面板中给它起个实体名为“泡泡”,如图5所示。
![图片点击可在新窗口打开查看](http://www.pconline.com.cn/pcedu/sj/wz/flash/0503/pic/10flashbubble09.gif)
图5
7. 点击“脚本”层的第1帧,按F9键打开的“动作”面板,输入如下代码:
// 复制影片
i = 1;
while (i<40){
duplicateMovieClip ("泡泡", "泡泡" add i, i);
i++;
}
stop();
好了,效果到这里就制作完成。