as3.0雪花随机飘落:package{importflash.display.MovieClip;importflash.events.*;publicclassSNOWextendsMovieClip{varspeedx:Number=0;varspeedy:Number=0;publicfunctionSNOW(){speedx=5*Math.random()-0.5;speedy=5*Math.random();this.addEventListener(Event.ENTER_FRAME,Mot);//constructorcode}functionMot(e:Event){this.x+=speedx;this.y+=speedy;if(this.y>400){init();}}functioninit(){this.y=0;this.x=Math.random()*550;}}}
1