# \[FMX\] question about a working button fader :)

**URL:** https://forum.kirupa.com/t/fmx-question-about-a-working-button-fader/80272
**Category:** flash
**Created:** [February 21, 2005, 2:07am UTC](https://forum.kirupa.com/t/fmx-question-about-a-working-button-fader/80272 "2005-02-21T02:07:00Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![MZA](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@MZA](https://forum.kirupa.com/u/MZA)
#### Post date: [February 21, 2005, 2:07am UTC](https://forum.kirupa.com/t/fmx-question-about-a-working-button-fader/80272/1 "2005-02-21T02:07:00Z")

</div>

Hey everyone. Im not the best actionscripter but i figure my way out of things.  
Heres my question about oddly enough a working script. heh…  
I made a button that fades up a movieclip and then the movieclip keeps fading down and up until on rollout where it fades it down. Now, i use a delete this.onEnterFrame; on the fade out button but im not sure if i should delete this.onEnterFrame in the functions where i fade up and down aswell. If so where/how?  
Also, you guys probably know a better solution for this so feel free to post that aswell, but pls post answer for the first question aswell so i learn it. (Im probably doing something wrong too, as always.)  
Here is the AS:

```auto
fadein = function(){
	if (white_1._alpha<=100) {
		white_1._alpha += 5;
	} else{
		this.onEnterFrame = fadeout;
	}
}
fadeout = function(){
	if (white_1._alpha>=0) {
		white_1._alpha -= 5;
	} else{
		this.onEnterFrame = fadein;
	}

}
fadeout2 = function(){
	if (white_1._alpha>=0) {
		white_1._alpha -= 5;
	} else{
		delete this.onEnterFrame;
	}

}

```

And for the button:

```auto
on(rollOver){
this.onEnterFrame = function(){
	fadein();
	}
}
on(rollOut){
this.onEnterFrame = function(){
	fadeout2();
	}
}

```

Thanks for any help! 🙂
