# Set Interval issues when using buttons

**URL:** <https://forum.kirupa.com/t/set-interval-issues-when-using-buttons/141581>\
**Category:** Uncategorized\
**Created:** [March 21, 2005, 4:55pm UTC](https://forum.kirupa.com/t/set-interval-issues-when-using-buttons/141581 "2005-03-21T16:55:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![graylensman](https://avatars.discourse-cdn.com/v4/letter/g/5f9b8f/32.png) [@graylensman](https://forum.kirupa.com/u/graylensman)\
**Post date:** [March 21, 2005, 4:55pm UTC](https://forum.kirupa.com/t/set-interval-issues-when-using-buttons/141581/1 "2005-03-21T16:55:17Z")

</div>

I have a problem with setInterval. I have a button; when you press the button three movie clips fade in and slide across screen. When I set the script so the mc’s move without button input, everything is fine. But when I try to set it up with an onRelease handler, BLOOIE!

Here’s the AS as it stands:

timer1 = setInterval(c1, 1000);  
timer2 = setInterval(c2, 1600);  
timer3 = setInterval(c3, 2200);  
\_root.namesTogether.caseOne.\_alpha = 0;  
\_root.namesTogether.caseTwo.\_alpha = 0;  
\_root.namesTogether.caseThree.\_alpha = 0;  
function c1() {  
\_root.namesTogether.caseOne.\_x += 50;  
if (\_root.namesTogether.caseOne.\_x \>= 200) {  
\_root.namesTogether.caseOne.\_x = 200;  
}  
\_root.namesTogether.caseOne.\_alpha += 30;  
if (\_root.namesTogether.caseOne.\_alpha \>= 100) {  
\_root.namesTogether.caseOne.\_alpha = 100;  
}  
clearInterval(timer1);  
};

function c2() {

```
	_root.namesTogether.caseTwo._x += 50;
	if (_root.namesTogether.caseTwo._x &gt;= 200) {
		_root.namesTogether.caseTwo._x = 200;
	}
	_root.namesTogether.caseTwo._alpha += 30;
	if (_root.namesTogether.caseTwo._alpha &gt;= 100) {
		_root.namesTogether.caseTwo._alpha = 100;
	}
	clearInterval(timer2);
};

```

function c3() {  
\_root.namesTogether.caseThree.\_x += 50;  
if (\_root.namesTogether.caseThree.\_x \>= 200) {  
\_root.namesTogether.caseThree.\_x = 200;  
}  
\_root.namesTogether.caseThree.\_alpha += 30;  
if (\_root.namesTogether.caseThree.\_alpha \>= 100) {  
\_root.namesTogether.caseThree.\_alpha = 100;  
}  
clearInterval(timer3);  
};

\_root.onlyBtn.onRelease = function (){  
\_root.onEnterFrame = function(){  
c1();  
c2();  
c3();  
}  
}

If anyone has any insight, I’d be very grateful for help!! I’ve attached my fla, for what it’s worth.

thanks again!
