# Can someone help me tighten up this code?

**URL:** <https://forum.kirupa.com/t/can-someone-help-me-tighten-up-this-code/242521>\
**Category:** flash\
**Created:** [October 26, 2007, 9:09pm UTC](https://forum.kirupa.com/t/can-someone-help-me-tighten-up-this-code/242521 "2007-10-26T21:09:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wildlettuce](https://avatars.discourse-cdn.com/v4/letter/w/cdc98d/32.png) [@wildlettuce](https://forum.kirupa.com/u/wildlettuce)\
**Post date:** [October 26, 2007, 9:09pm UTC](https://forum.kirupa.com/t/can-someone-help-me-tighten-up-this-code/242521/1 "2007-10-26T21:09:07Z")

</div>

I am a newbie at this and this is the best site on the web for learning. So I hope someone can help me out.

I am designing a set of instructions. Each instruction movie clip is in a different place on the stage. There is a numbered button to go with each step and there are 13 steps. Each step should fade in when its button is pressed and dim when the next button is pressed. I would also like all instructions that follow a button to alpha to 0. For instance if you are on 4 and click on 2, 4 and 3 should alpha to 0. On the seventh button I need to have the first 6 instructions alpha to 0.

Here is the code for the first 6 buttons:

\_root.one\_btn.onRelease = function() {  
\_root.one\_mc.gotoAndPlay(“lit”);  
}  
\_root.two\_btn.onRelease = function() {  
\_root.one\_mc.gotoAndPlay(“dim”);  
\_root.two\_mc.gotoAndPlay(“lit”);  
}  
\_root.three\_btn.onRelease = function() {  
\_root.one\_mc.gotoAndPlay(“dim”);  
\_root.two\_mc.gotoAndPlay(“dim”);  
\_root.three\_mc.gotoAndPlay(“lit”);  
}  
\_root.four\_btn.onRelease = function() {  
\_root.one\_mc.gotoAndPlay(“dim”);  
\_root.two\_mc.gotoAndPlay(“dim”);  
\_root.three\_mc.gotoAndPlay(“dim”);  
\_root.four\_mc.gotoAndPlay(“lit”);  
}  
\_root.five\_btn.onRelease = function() {  
\_root.one\_mc.gotoAndPlay(“dim”);  
\_root.two\_mc.gotoAndPlay(“dim”);  
\_root.three\_mc.gotoAndPlay(“dim”);  
\_root.four\_mc.gotoAndPlay(“dim”);  
\_root.five\_mc.gotoAndPlay(“lit”);  
}

It is really buggy. I keep thinking there has to be an easier way to do this. I have looked into arrays, but I can’t seem to find a situation with specifically placed movie clips. I am eager to learn. Please help.
