1 Reply Latest reply on Jul 10, 2009 5:41 AM by Ned Murphy

    Fade In / Fade Out alpha tweens not working???

    keithwoods

      Hi guys....I need another pair of eyes on this code cos it's been doing my head in for the past 3 days!

      I've got a function 'onIntroFinished' which starts two tweens (musicPlayerIntro and fullResetBtnIntro). After each tween, an eventlistener is added to that particular tween to see when it's ended, so it can call on another function to start a new tween.

      The first tweens complete within the 'onIntroFinished' function....however, they don't go on to start the second tween in the 'musicPlayerIntro2' and 'fullResetBtnIntro2' functions?

      The trace statements are getting called for the second tween functions, so they're getting through to that point, but why aren't the tweens starting?  Ocassionally when I test it, the second tweens half work, fading out to 50% alpha, but then stop and stay visible, rather than fully fading out.

      Is this necessarilly the best way to do a fade In/fade out alpha tween?  ANy pointers greatly appreciated!

      ActionScript Code:
      private function onIntroFinished(event:Event = null):void
                  {
                     
                      var musicPlayerIntro:Tween = new Tween(musicPlayer, "alpha", Regular.easeIn, musicPlayer.alpha, 1, 1, true);
                      musicPlayerIntro.addEventListener(TweenEvent.MOTION_FINISH,musicPlayerIntro2);
                     
                      var fullResetBtnIntro:Tween = new Tween(fullResetBtn, "alpha", Regular.easeIn, fullResetBtn.alpha, 1, 1, true);
                      fullResetBtnIntro.addEventListener(TweenEvent.MOTION_FINISH,fullResetBtnIntro2);

                     
                  }// #*#*#*    end of onIntroFinished function
                 
                  private function musicPlayerIntro2(evetn:Event):void
                  {
                      trace("Second tween func for musicPlayer starting...");
                      var musicPlayerIntro2:Tween = new Tween(musicPlayer, "alpha", Regular.easeOut, musicPlayer.alpha, 0, 4, true);
                  }// #*#*#*    end of musicPlayerIntro2 func
                 
                  private function fullResetBtnIntro2(event:Event):void
                  {
                      trace("Second tween func for fullResetBtn starting...");
                      var fullResetBtnIntro2:Tween = new Tween(fullResetBtn, "alpha", Regular.easeOut, fullResetBtn.alpha, 0, 1, true);
                  }// #*#*#*    end of fullResetBtnIntro2 func