title: AS3 flash, Array objects are carrying over into next frame and causing null object error
body: <p>//I commented out the section that I was trying, but so far nothing has been working. I know I need to set up a loop or something of that kind to get rid of the items in the array, but I'm not sure how to get the right outcome.
  THANKS SO MUCH</p>
  
  <pre><code>import flash.utils.Timer;
  import flash.display.MovieClip;
  import flash.events.Event;
  
  
  var loveXCounter: Number = 0;
  
  
  healthLove_txt.text = "Wrong Words: 0";
  
  
  var insideLoveXCount = new Timer(4000, 0)
  
  
  insideLoveXCount.addEventListener(TimerEvent.TIMER, countLoveX);
  
  
  insideLoveXCount.start();
  
  
  var loveXList: Array = ["Hate", "Abhor", "Vile", "Dislike", "Enmity", "Illwill", "Loath", "Neglect", "Repulse", "Resent"];
  
  function countLoveX(e: TimerEvent) {
      var loveXName: String = loveXList[Math.floor(Math.random() * loveXList.length)];
  
      var loveXReference: Class = getDefinitionByName(loveXName) as Class;
  
      var myLoveX = new loveXReference;
  
      myLoveX.x = Math.random() * 700;
      myLoveX.y = -10;
      myLoveX.speed = 5;
      myLoveX.addEventListener(Event.ENTER_FRAME, fallingLoveX);
      addChild(myLoveX);
      loveXList.splice(loveXName, 1);
  }
  
  function fallingLoveX(e: Event): void {
  
      if (e.target.hitTestObject(fb_mc)) {
          e.target.visible = false;
          loveXCounter = loveXCounter + 1;
          e.target.removeEventListener(Event.ENTER_FRAME, fallingLoveX);
          healthLove_txt.text = "Wrong Words: " + loveXCounter;
          if (loveXCounter == 5) {
          while( loveXList.length &gt; 0 )
  {
      this.removeChild( loveXList[loveXList.length - 1] );
      loveXList.pop();
  }
              MovieClip(root).gotoAndStop(137);
              loseBook_mc.gotoAndStop("loseLove");
  
          }
      }
  
      if (e.target.y &lt; 800) {
          e.target.y += e.target.speed;
          if (e.target.y &gt; 800) {
              e.target.y = 800;
  
          }
      } else {
          e.target.visible = false;
      }
  }
  
  stop();
  </code></pre>