关于Java侦听事件的移除
用as3.0做了以下代码,然后在主舞台调用,怎么让下雪停止,怎么在指定的帧停止package {
import flash.display.MovieClip;
import flash.events.Event;
public class makeSnow extends MovieClip{
public function makeSnow() {
stage.addEventListener(Event.ENTER_FRAME,snowInit);
function snowInit(e:Event){
var mcSnow:snow=new snow();
mcSnow.y=20;
mcSnow.x=stage.stageWidth*Math.random();}
addChild(mcSnow);
if(mcSnow.y>350)
{
mcSnow.removeEventListener(Event.ENTER_FRAME,snowInit);
}
mcSnow.scaleX = mcSnow.scaleY = Math.random() * 2;
var mcSpeed:Number=Math.random()*5;
mcSnow.addEventListener(Event.ENTER_FRAME,snowFall);
function snowFall(e:Event){
mcSnow.y+=mcSpeed;
mcSnow.rotation+=Math.random()*3;
}
}
}
}