# Fade in/out...should be simple

**URL:** <https://forum.kirupa.com/t/fade-in-out-should-be-simple/180838>\
**Category:** Uncategorized\
**Created:** [March 3, 2006, 7:27pm UTC](https://forum.kirupa.com/t/fade-in-out-should-be-simple/180838 "2006-03-03T19:27:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sbarton22](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sbarton22/32/2204_2.png) [@Sbarton22](https://forum.kirupa.com/u/Sbarton22)\
**Post date:** [March 3, 2006, 7:27pm UTC](https://forum.kirupa.com/t/fade-in-out-should-be-simple/180838/1 "2006-03-03T19:27:46Z")

</div>

I’m trying to do something EXTREMELY simple, but all of my ideas run into dead ends. I simply want to have a box fade in and then fade out. No problem, right? If someone could give me a hand, that would be great.

So far, I can get my box to fade in. The box is a mc on layer 1 and the AS is on an actions layer. My best idea is to run the alpha from 0 to 100, and then at 100% trigger the opposite direction. I thought I could do this in one frame, but it always ends in a loop fading from something like 80%-90%-80%…so on. So then, I come up with at 100% alpha, move to frame 2 and fade out. For some reason, I can get it to stop and fully run frame 1 before jumping to 2.

Here is my code on an actions layer on frame 1:

(stop);  
box01.\_alpha=0  
box01.onEnterFrame = function() {  
if (this.\_alpha\<=99){  
this.\_alpha+=10;  
}  
if (this.\_alpha==100){  
gotoAndPlay(2)  
}  
}

Any brilliant ideas out there to help me out?  
Thanks in advance
