flash我在一段场景中运用action雪花飘落但是一直飘停步下来怎么使他停下来

来源:百度知道 编辑:UC知道 时间:2024/06/09 03:04:51
在一段场景中要运用雪花飘落效果,后面不用,但是我的后面一直飘怎么让他停。代码如下this.onLoad = function (){
n = 60;
var i = 1;
while (n >= i){
this.attachMovie("snow", "snow" + i, i);
var a = Math.round(60 * Math.random() + 41);
var b = Math.round(50 * Math.random() + 51);
with (this["snow" + i]){
_x = 550 * Math.random();
_y = 400 * Math.random();
_xscale = a;
_yscale = a;
_alpha = b;
_rotation =a;
this["snow" + i].x = Math.cos(Math.PI * Math.random());//雪花沿x轴每帧播放后的位移增量
this["snow" + i].y = 2+ 2*Math.random();//雪花沿y轴每帧播放后的位移增量
}
i++;
}
}
this.onLoad();
this.onEnterFrame = function(){
var a = 1;
while (n>= a){
with (this["snow" + a]){
_x += x;
_y += y;
_rotation += y;
if (_y > 400){
_y =0;
}else if (_x>550){
_x=0;
}else if(_x<0){
_x=550;
}
}

把这一场雪做在一个元件里面吧。然后,在你不需要的时候,把这包含有一场雪的元件删除就可以的了。

当然了,你也可以试着用delete来删除这个onEnterFrame这个函数。