Code:var bigstar:thestar; var midstar:thestar; var smallstar:thestar; var stars:Array = []; var i:int = 25; while (i-- > 0) { bigstar=new thestar(); bigstar.width = 18; bigstar.height = 13; starReset(bigstar); addChild(bigstar); stars.push(bigstar); } addEventListener(Event.ENTER_FRAME, doLoop); function doLoop(e:Event) { var star:thestar; for each (star in stars) { star.y += star.speed; if (star.y > 410) { starReset(star); } } } function starReset(mc) { mc.x = Math.random() * stage.stageWidth; mc.y = -30; mc.speed = Math.random() * 2 + 1; }




Reply With Quote