# Button fade in/out with AC2.0

**URL:** https://forum.kirupa.com/t/button-fade-in-out-with-ac2-0/318648
**Category:** flash
**Created:** [January 26, 2011, 3:58am UTC](https://forum.kirupa.com/t/button-fade-in-out-with-ac2-0/318648 "2011-01-26T03:58:33Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![s6xspeed](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@s6xspeed](https://forum.kirupa.com/u/s6xspeed)
#### Post date: [January 26, 2011, 3:58am UTC](https://forum.kirupa.com/t/button-fade-in-out-with-ac2-0/318648/1 "2011-01-26T03:58:33Z")

</div>

hi,  
i have a button that i would like to cursor over and that image slowly fades revealing the image behind and when the cursor is moved the image slowly fades in.

the coding that ive gathered so far from a few sources is as follows:

var fade;  
mslogo\_c.\_alpha = 0;

MovieClip.prototype.HitMe = function(goTo, returnTo){  
this.onEnterFrame = function(){  
if(this.hitTest(\_xmouse, \_ymouse, true)){  
if (this.\_alpha \< 100) { this.\_alpha += 5; };  
}else{  
if (this.\_alpha \> 0) {  
this.\_alpha -= 5;  
}else{  
delete this.onEnterFrame;  
setRollOvers();  
}  
}  
}  
};

setRollOvers = function(){  
mslogo\_c.onRollOver = function(){  
this.HitMe(10, 1);  
delete this.onRollOver;  
}  
}

setRollOvers();

any help or direction would be great
