# Help with alpha fades

**URL:** <https://forum.kirupa.com/t/help-with-alpha-fades/211145>\
**Category:** flash\
**Created:** [December 27, 2006, 9:59pm UTC](https://forum.kirupa.com/t/help-with-alpha-fades/211145 "2006-12-27T21:59:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adman](https://avatars.discourse-cdn.com/v4/letter/a/ccd318/32.png) [@Adman](https://forum.kirupa.com/u/Adman)\
**Post date:** [December 27, 2006, 9:59pm UTC](https://forum.kirupa.com/t/help-with-alpha-fades/211145/1 "2006-12-27T21:59:10Z")

</div>

Hi, this is my first real time trying to use flash. I’ve got a few books and read a lot of stuff, but the only way you learn is just by diving in and trying to do stuff. I’m trying to accomplish a very simple animation for you guys proably, an alpha fade. What I have is a movie clip symbol that is part of my nav bar on my site. The way it is setup is that I have the text at 70% alpha an a background at 0% alpha, when you roll over the text, i want each of those to fade to 100% alpha, then when you roll over, you fade back down to 70% and 0%. For the life of me, I cannot get this too work. I can get on thing to fade, but not the other. I’ve tried prototypes, functions, anything. This is not my first programming experience, I’m ■■■■ good at C++ and PHP, but learning a new language is just really learning the quirks, syntax, and stuff like that.

I tried this code

```auto

Fade = function(Image:MovieClip, Speed:Number, Target:Number){
    Image.onEnterFrame = function() {
        Image._alpha += Speed;    
        
        if(Image._alpha >= Target && Speed > 0){
            Image._alpha = Target;
            delete this.onEnterFrame;
        } else if(Image._alpha <= Target && Speed <0) {
            Image._alpha = Target;
            delete Image.onEnterFrame;
        }
    }
}

```

I’ve also but that code into a prototype basically.

I’ve tried to execute the code like this, but putting the action script inside the button

```auto

on(rollOver){ //this is the text, or the button
  //if i were using it as a prototype function
  this.Fade(4,100);
  HomeDecorations.Fade(4,100); //I don't know how to reference the movie clip home decorations from inside the button. possibly _parent.HomeDecorations.Fade()?
}

```

The only way i’ve gotten anything to work is with prototype’s, but then everything need to be a movie clip. I tried to make a prototype for a button, but that didn’t work. My ultimate goal is to write a fade function that I can apply to any object anywhere. Maybe a class?

Thanks for the help.
