as3.0 雪花随机飘落: package { import flash.display.MovieClip; import flash.events.*; public class SNOW extends MovieClip{ var speedx:Number=0; var speedy:Number=0; public function SNOW() { speedx=5*Math.random()-0.5; speedy=5*Math.random(); this.addEventListener(Event.ENTER_FRAME,Mot); // constructor code } function Mot(e:Event){ this.x+=speedx; this.y+=speedy; if(this.y>400){ init(); } } function init(){ this.y=0; this.x=Math.random()*550; } } }
2019-11-02 13:11:01 9KB as3.0 雪花飘落
1