我正在我的 AIR 应用程序上处理 Actionscript 3 代码,在一个中间场景中。当我滑动到另一个场景时,雪刷新并继续下落。我应该在下面显示的雪代码场景之前和之后在场景中输入什么代码,以阻止雪代码再次发生?
"stop();
//Snow Flake Animation start
var snowarr = new Array();
var maxflakes:int = 60;
for(var s:int = 0; s<maxflakes; s++)
{
var sf:snowflake = new snowflake();
addChild(sf as DisplayObject);
sf.x = Math.random()*stage.stageWidth;
sf.y = 0-Math.random()*stage.stageWidth;
var snowsize:Number = .3+(Math.random()*.6);
sf.scaleX = sf.scaleY = sf.snowsize = snowsize;
snowarr.push(sf);
sf.cacheAsBitmap = true;
}
for(s = 0; s<maxflakes; s++)
{
sf = new snowflake();
addChild(sf as DisplayObject);
sf.x = Math.random()*stage.stageWidth;
sf.y = 0-Math.random()*stage.stageWidth;
snowsize = .9+(Math.random()*.6);
sf.scaleX = sf.scaleY = sf.snowsize = snowsize;
snowarr.push(sf);
sf.cacheAsBitmap = true;
}
function updateFlakes(event:Event):void
{
for(var f:int = 0; f<(maxflakes*2); f++)
{
snowarr[f].y+=snowarr[f].snowsize*4;
if(snowarr[f].y>stage.stageHeight)
{
snowarr[f].y-=stage.stageHeight;
}
}
}
addEventListener(Event.ENTER_FRAME, updateFlakes);
//Snow flake Animation End"