Adding another for loop to an onRelease function

I do not know what I am doing wrong with this…I have a block of code that I want to execute when one of five buttons is pressed…(does not matter which one, it executes the same for all)

Here is what I am wanting to add:

for(var w=0; w<48; w++){
this[“mystate”+w].enabled = true;
}

Now I know this works by itself, I just can’t get it to work onPress of the button(s), because there is already alot going on with the onPress function. Here is all the code associated with the buttons, everything in this code does work:

for (var s = 0; s<19; s++) {
myArray.push(this[“mystate”+s]);
}
for (var g = 0; g<myArray.length; g++) {
myArray[g][“myColour”+g] = new Color(myArray[g]);
myArray[g].col = myArray[g][“myColour”+g].getTransform();
}
for (var j = 0; j<5; j++) {
[COLOR=DarkRed]this[“color”+j].onPress = function() {[/COLOR]
for (var i = 0; i<myArray.length; i++) {
myColour = new Color(myArray*);
myColour.setRGB(this.col);
_root.maincolor = this.col;
reset._visible = false;
finalName = “Please choose one of your opponents states”;
colorline._alpha = 0;
color0._visible = false;
color1._visible = false;
color2._visible = false;
color3._visible = false;
color4._visible = false;
myArrow._visible = true;
}
};

I try adding it in so many different spots after this[“color”+j].onPress = function() {

I am guessing I cannot simply add in for(var w=0; w<48; w++){
this[“mystate”+w].enabled = true;
}

and have it work but I am looking for what else I need to do. I am thinking the previous for loops maybe are effecting the new for loop I am trying to add in, but I don’t know. Can someone please help?