# Fade in and out effect

**URL:** <https://forum.kirupa.com/t/fade-in-and-out-effect/220757>\
**Category:** Uncategorized\
**Created:** [March 28, 2007, 11:13pm UTC](https://forum.kirupa.com/t/fade-in-and-out-effect/220757 "2007-03-28T23:13:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qpixo](https://avatars.discourse-cdn.com/v4/letter/q/c4cdca/32.png) [@qpixo](https://forum.kirupa.com/u/qpixo)\
**Post date:** [March 28, 2007, 11:13pm UTC](https://forum.kirupa.com/t/fade-in-and-out-effect/220757/1 "2007-03-28T23:13:35Z")

</div>

I have a few images that I want them to appear fade in while my mouse is over each of them. My question is, do I have to define an proper area to make it work? For now on, it’s ONLY work once when I first load my.swf

ps: It won’t recognize the area if I first define image1\_mc.\_visible = false; image2\_mc.\_visible = false;

Please help!

Here’s my current:

// I don’t want them to appear at beginning  
image1\_mc.\_alpha = 1;  
image2\_mc.\_alpha = 1;

// Fade in while my mouse is on  
image1\_mc.onRollOver = function() {  
this.\_alpha = 20;  
image1\_mc.onEnterFrame = function() {  
this.\_alpha += 5;  
}  
}

// Fade out  
image1\_mc.onRollOut = function() {  
this.\_visible = false;

}
