title: My class has some timing issues
body: <p>I have a class that I use to display text on stage, with some number effects. It works pretty well, but when I chain it like this</p>
  
  <pre><code>    public function onAdd(e:Event) {
          //stuff
          addChild(new messager("Welcome."));
          addChild(new messager("WASD to move, mouse to shoot."));
          addChild(new messager("Kill zombies for XP and collect ammo boxes.",waveOne));
      }
      public function waveOne(){
          addChild(new messager("Good luck and have fun.",newWave));
      }
  </code></pre>
  
  <p>The text (Good luck and have fun) is not displayed, but newWave is called. The reason why I don't call waveOne in onAdd is so that it doesn't happen too quick - my class just throws the text at the user once every 50 frames (which is intended, for later when you kill enemies and the text needs to catch up).</p>
  
  <p>Here is my class (with the effects removed):</p>
  
  <pre><code>package  {
  
  import flash.display.MovieClip;
  import flash.events.*;
  import flash.utils.Timer;
  
  public class Messager extends MovieClip{
      var actualText:String;
      var callback:Function;
      var upTo:int = 0;
      static var waitingFor:int = 0;
      public function Messager(text:String,callback:Function=null) {
          this.callback = callback;
          actualText = text;
          x = 320 - actualText.length * 6.5;
          y = 0 - waitingFor * 60;
          addEventListener(Event.ENTER_FRAME, onEnterFrame);
          waitingFor++;
      }
      public function onEnterFrame(e:Event) {
          y+= 1;
          if(y &gt; 60){
              waitingFor--;
          }
          if(y &gt; 200){
              alpha -= 0.03;
              if(alpha &lt;= 0){
                  if(callback != null){
                      callback();
                  }
                  removeEventListener(Event.ENTER_FRAME, onEntFrm);
                  this.parent.removeChild(this);
              }
          }
      }
  }
  </code></pre>
  
  <p>It is set to linkage with a movieclip that has a textfield.</p>
  
  <p>Thanks for any help.</p>