7 Replies Latest reply on Apr 7, 2009 3:55 PM by kglad

    Fading in an MC works, fading out doesn't

    Level 1

      Hi,

       

      I can't work out why - but when I try to fade out some text (by calling fadeoutSecondText), the text fades out, and then immediately fades back in. Fading in and out struggle against each other, resulting in rapidly flashing text!

       

      Here's the code:

       

      I've got a function to fade in SecondText, which runs 1.5 seconds after another clip is faded out (called from *1):

       

      function FadeInSecondLoad() {
          TheCloud.SecondText._alpha += fadeAmount;
          if (TheCloud.SecondText._alpha>=100) {
              TheCloud.SecondText._alpha = 100;
              TheCloud.SecondText.onEnterFrame = null;
          clearInterval(myTimer);
         }

       

      ... and a function to fade out SecondText when a button is clicked (called from *2)

       

      function fadeoutSecondText() {
      TheCloud.SecondText._alpha -= fadeAmount;
          if (TheCloud.SecondText._alpha<=1) {
              TheCloud.SecondText._alpha = 0;
              TheCloud.SecondText.onEnterFrame = null;

      }}

       

       

      ----------------------

       

      (*1)

      function fadeOutIntro() {
          TheCloud.IntroText._alpha -= fadeAmount;
          if (TheCloud.IntroText._alpha<=1) {
              TheCloud.IntroText._alpha = 0;
              TheCloud.IntroText.onEnterFrame = null;
          }
          myTimer = setInterval(FadeInSecondLoad,1000);
          }

       

      (*2)

       

      cloudtopleft.onRelease = function() {
          cloudtopleft.onEnterFrame = fadeoutSecondText;
      }

       

      Please let me know if this isn't enough info, or if you'd rather see the .fla.

       

      Many thanks!