pall为水珠影片剪辑
var count:int = 500; var zl:Number = 0.5; var balls:Array; balls = new Array(); for (var i:int = 0; i < count; i++) { var ball:pall = new pall(); ball.x = 260; ball.y = 300; ball["vx"] = Math.random() * 2 - 1; ball["vy"] = Math.random() * -10 - 10; addChild(ball); balls.push(ball); } addEventListener(Event.ENTER_FRAME, onEnterFrame); function onEnterFrame(event:Event):void { for (var i:Number = 0; i < balls.length; i++) { var ball:pall = pall(balls[i]); ball["vy"] += zl; ball.x += ball["vx"]; ball.y += ball["vy"]; if (ball.x - ball.width/2> stage.stageWidth || ball.x + ball.width/2 < 0 || ball.y - ball.width/2 > stage.stageHeight || ball.y + ball.width/2 < 0) { ball.x = 260; ball.y = 300; ball["vx"] = Math.random() * 2 - 1; ball["vy"] = Math.random() * -10 - 10; } } }