There are many snippets online on how to fade, but each with it’s own flaw – some incomplete, some using AS3’s default Tween (yuck). After trying to figure out it for myself, I came up with this. The following is a working example of placing some text on the stage, fading from 0 to 100 alpha, then back to 0.
To start off, import the classes needed. I’m using the TweenLite library, widely regarded as the best (so I’ve heard), better than the default Adobe Tween. After using their website demos, you’ll see it’s much faster. You’ll need to grab the library, and place the com folder from the .zip into the folder with your .fla, as instructed in the Getting Started Guide.
// remember to import import com.greensock.*; import com.greensock.easing.*; import flash.text.TextField; import flash.text.TextFormat; import flash.text.TextFieldAutoSize; import flash.text.Font;