Small Fader Function Flash MX

this.createEmptyMovieClip ("fader",5);

fader.onEnterFrame = function()
{
if (myobject._alpha >= 0)
{
trace("fading:" + myobject._alpha);
myobject._alpha -= 1;
}
else
{
trace("end of faiding")
delete (this.onEnterFrame);
}
}

2 thoughts on “Small Fader Function Flash MX”

  1. Hi Helmut,
    Been playing with your big fader script and added a _xscale variation, now I can have thumbnails that take up less space and are less distracting. Thought you might be interested. Thanks for another lesson.
    Richard
    //fader code by Helmut http://www.helmutgranda.com/blog, tweaked for scale
    MovieClip.prototype.fadeObject = function(whichObject, speed, fadeInorfadeOut ) {
    this.whichObject = whichObject;
    this.speed = speed;
    this._xscale = scale;
    this.fadeInorfadeOut = fadeInorfadeOut;
    if (fadeInorfadeOut == “fadeIn”) {
    whichObject._alpha = 40;
    whichObject._xscale = 300;
    } else if (fadeInorfadeOut == “fadeOut”) {
    whichObject._alpha = 100;
    whichObject._xscale = 165;
    }
    this.onEnterFrame = function() {
    if (fadeInorfadeOut == “fadeOut”) {
    if (whichObject._alpha>=40) {
    whichObject._alpha -= speed;
    whichObject._xscale -= speed;
    } else {
    delete (this.onEnterFrame);
    }
    } else if (fadeInorfadeOut == “fadeIn”) {
    if (whichObject._alpha

  2. Great!, Now you see how easily it is to add more parameters to the function.

    Once the basics are down everything else seems easier.

    gj :o)

Comments are closed.