Dynamic Fadeouts with the Tween Class

alpha tweening 

If you ever needed a quick dynamic solution for fade-outs and ins – here it is:
 

import mx.transitions.Tween; // first the import
MovieClip.prototype.alphize = function(from,to,speed) //movieclip extended
{
  // and a proper usage of the Tweening Class 
  var alphizeT:Tween = new Tween(this,"_alpha",mx.transitions.easing.Regular.easeOut,from,to,speed,false);
};
// example usage
YourMC.onRollOver = function()
{
  this.alphize(this._alpha,100,10);
};
YourMC.onRollOut = function()
{
  this.alphize(this._alpha,0,10);
};
And that's more or less an easy way to smoothly fadein/out movieclips without those glitchy animation errors when using the Timeline (bleh!). I'll extend this idea onto other uses in my next posts.

You can download the .FLA source here
Have Fun,

Flaim

Leave a Reply