# Set interval

**URL:** https://forum.kirupa.com/t/set-interval/296773
**Category:** Uncategorized
**Created:** [September 20, 2009, 7:26am UTC](https://forum.kirupa.com/t/set-interval/296773 "2009-09-20T07:26:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![m3300118z](https://avatars.discourse-cdn.com/v4/letter/m/ecb155/32.png) [@m3300118z](https://forum.kirupa.com/u/m3300118z)
#### Post date: [September 20, 2009, 7:26am UTC](https://forum.kirupa.com/t/set-interval/296773/1 "2009-09-20T07:26:02Z")

</div>

I have a box movie clip called box that fades in then pauses and then fades out. how can I set the interval before this plays?

Also as I am pretty new to this how do I get my post to be viewable as asctionscript properly?

function fadeIn() {  
if (box.\_alpha\<100) {  
box.\_alpha += 1;  
} else {  
clearInterval(fadeInterval);  
setTimeout(startOut, 4000);  
}  
}  
function fadeOut() {  
if (box.\_alpha\>0) {  
box.\_alpha -= 1;  
} else {  
clearInterval(fadeInterval);  
}  
}  
function startOut() {  
fadeInterval = setInterval(fadeOut, 30);  
}  
box.\_alpha = 0;  
var fadeInterval = setInterval(fadeIn, 10);
