FLASH停止特效
我在开头第一帧写入
this.onLoad = function (){
n = 40;
var i = 1;
while (n >= i){
this.attachMovie("snow","snow"+i,i);
var a = Math.round(40 * Math.random() + 41);
var b = Math.round(20 * Math.random() + 51);
with (this["snow" + i]){
_x = 640*Math.random();
_y = 480*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>480) {
_y =0;
} else if (_x>640) {
_x=0;
} else if (_x<0) {
_x = 640;
}
}
a++;
}
}
但是我想在第二场景停止它怎么办啊?
哪位大侠知道怎么办吗?
参考答案:我把程序稍微改了一下,你可以在场景的帧上直接加代码
for (var i = 0; i<100; i++) {
_root.attachMovie("snow", i, i);
_root[i]._x = 550*Math.random();
_root[i]._y = 400*Math.random();
_root[i]._rotation = 60*Math.random();
_root[i]._xscale = _root[i]._yscale=_root[i]._alpha=100*Math.random();
_root[i].onEnterFrame = function() {
//this._x+=this._xscale/10
//this._x%=550
this._y += this._yscale/10;
this._y %= 400;
};
}var j=0;
_root.onEnterFrame=function(){
j++;if(j>=40)
{ for(var k=0;k<100;k++)
_root[k].removeMovieClip();
}
}