# Loop issues

**URL:** <https://forum.kirupa.com/t/loop-issues/220819>\
**Category:** flash\
**Created:** [March 29, 2007, 3:21pm UTC](https://forum.kirupa.com/t/loop-issues/220819 "2007-03-29T15:21:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dru\_nasty](https://avatars.discourse-cdn.com/v4/letter/d/90db22/32.png) [@dru\_nasty](https://forum.kirupa.com/u/dru_nasty)\
**Post date:** [March 29, 2007, 3:21pm UTC](https://forum.kirupa.com/t/loop-issues/220819/1 "2007-03-29T15:21:47Z")

</div>

I’ve got 7 buttons with instance names btn1, btn2, etc. I’ve also got 7 white square movieclips to alpha in over the button when one of the buttons is rolled over. To shorten code I’m using a loop.

```auto

for (var i = 1; i <= 7; i++){
	
	 var btn = this["btn"+i];
	 btn.id = i;
	 var mc = this["mc"+i];
	 
     btn.onRelease = function(){
		 trace(this.id);
		 _root.attachMovie("flashemo"+this.id,"fe"+i, i);
	 }
	 btn.onRollOver = function() {
		 mc.alphaTo(70, 0.5, "easeOutQuad", 0);
	 }
	  btn.onRollOut = function() {
		mc.alphaTo(0, 0.5, "easeOutQuad", 0);
	 }
}

```

But my rollover effect isn’t working. If i replace mc with mc1 or whatever in the code it does work. Any suggestions?
