5 Replies Latest reply on Jun 17, 2007 5:04 PM by kglad

    removeChild() cuts off fade out animation

      I have a custom class with fadeIn() and fadeOut() methods to fade in and fade out a movie clip. Essentially, I add an onEnterFrame listener that increases/decreases the alpha by .1 per frame until the alpha is either 1or 0, then remove the listener.
      So, I add a child to the stage, addChild(myMovieClip), set its alpha to 0, then call the myMovieClip.fadeIn() method and this works great. However, when I call myMovieClip.fadeOut() followed by removeChild(myMovieClip), we never see the fadeOut, the clip just blinks out of existence because it is not waiting for the fade out animation to complete before removing the movie clip from the stage.

      How do I make the removeChild() function "wait" until the fade out is actually complete?

      Do I need to setup a Timer function to check the movie clip's current alpha value before issuing the removeChild() function? Or is there a simpler way that I'm just overlooking?