title: How to delete all event listeners at once in AS3
body: <p>I'm making a small game in as3.</p>
  
  <p>The game contains 10 levels.</p>
  
  <p>When i enter 1 level everything is alright. But when i enter the second level (frame) the event listeners from the first frame are still working and a recieve a warning saying ' Cannot access an object of null objct reference'. This is because i delete every object of the first level and th add the objects from stage 2.</p>
  
  <p>I've tried using removeEventListeners, but it doesn't work, cause ENTER_FRAME Listeners work one more time after I remove the Event Listeners.</p>
  
  <p>I've tried using different frames for different levels, bit it doesn't work. Also i tried using 1 frmae for all 10 frames, but i recieve much many warning and the Flash Loader is overloaded.</p>
  
  <p>How can i switch through levels (back and forward)? Thanks in advance.</p>
  
  <pre><code>  addEventListener(Event.ENTER_FRAME, subtracting2);
       arrListeners.pop(); // poping it out of the array because it will be deleted after the count reaches 0
       function subtracting2 (e:Event):void
       {
          count--;
          var FAcoef:Number = count/30; //
          FadeAway.alpha = FAcoef; //                   Some effect like FadeAway
          setChildIndex(FadeAway, numChildren - 1); //
          if(count == 0)
         {
              setChildIndex(FadeAway, 0);
              removeEventListener(Event.ENTER_FRAME, subtracting2);
          }
      }
  </code></pre>