title: Generate random falling objects in AS3
body: <p>I want to create a set of random objects to fall down the stage in a loop.</p>
  
  <p>So far I have created a test object to fall at a random x coordinate. I am having trouble working out how to loop the falling function so multiple instances of the object continuously fall.  </p>
  
  <pre><code>var randomX:Number = Math.random() * 800;
  
  test_mc.x = randomX;
  test_mc.y = 0;
  
  var speed:Number = 10;
  
  test_mc.addEventListener(Event.ENTER_FRAME, moveDown);
  
  function moveDown(e:Event):void
  {
   e.target.y += speed; 
  
   if(e.target.y &gt;= 480)
   {
        test_mc.removeEventListener(Event.ENTER_FRAME, moveDown);
   }
  }
  </code></pre>