# Fade Function call

**URL:** <https://forum.kirupa.com/t/fade-function-call/128784>\
**Category:** Uncategorized\
**Created:** [November 16, 2004, 6:01am UTC](https://forum.kirupa.com/t/fade-function-call/128784 "2004-11-16T06:01:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![outro\_lugar](https://avatars.discourse-cdn.com/v4/letter/o/35a633/32.png) [@outro\_lugar](https://forum.kirupa.com/u/outro_lugar)\
**Post date:** [November 16, 2004, 6:01am UTC](https://forum.kirupa.com/t/fade-function-call/128784/1 "2004-11-16T06:01:33Z")

</div>

**I have a function on root:**

\_root.fadeBox\_mc.onEnterFrame = function (){  
if (fade){  
this.nextFrame();  
} else {  
this.prevFrame();  
}  
};

**and on root, a button with the code**

on (rollOver){  
\_root.fade = true;  
}

on (rollOut){  
\_root.fade = false;  
}

**This causes a mc to fade in and out on rollover/rollout. But what I wanna make is a box that fades in when pressed on the button and fade out when pressed for the second time. But if I say**

on (press){  
\_root.fade = true;  
}

the mc fades in, but I cant do another on (press) to fade out. Is this too confusing? Please help.
