1 Reply Latest reply on Feb 28, 2011 5:03 AM by Ned Murphy

    As2 Set Timer fade out (alpha)

    Gu55tav Level 1



      Im using the following bit of code to advance through frames at a set interval. Each frame consists of a different quote (text) and while this works fine I want to add in a fade effect so that for the last second of the frame the alpha of the frame reduces from 100 to 0.


      Here is the timer code im using:


      function goNext(){
      var timer = setInterval(goNext, 10000);


      If anyone could help i would be most grateful!



        • 1. Re: As2 Set Timer fade out (alpha)
          Ned Murphy Adobe Community Professional & MVP

          In order to fade things out you'll need to use some form of actionscript tween, and since you want it to happen 1 second before the change of frames, you are probably better of using the timer for triggering the tween and use a listener for the tween completion to move to the next frame.  You'll need to place the text inside a movieclip that you can target with code for the fading effect.  Instead of using setInterval, you should probably just use setTimeout.  It'll save you the extra code for clearing the interval.


          You can use the built in Tween class as a starter, though some folks recommend using a third party tweening class such as TweenLite.  You should be able to find sample code via a Google search.

          1 person found this helpful