Make button work only according to Array

Hi there,

I’m attempting to allow **only **the buttons that are in my array work during MOUSE_OVER.

The tricky thing for me is identifieing more than one button in the same if statement. Does the onButtonOver function need to be in a for loop?

Appologies if this is a noobie question.

var myArray=[3, 4];

for (var i:int = 0; i < buttonArray.length; i++) {
	this["btn"+i].addEventListener(MouseEvent.MOUSE_OVER, onButtonOver);
	this["btn"+i].buttonMode=true;
	this["btn"+i].mouseChildren=false;
	this["btn"+i].button=i;
}

function onButtonOver(e:MouseEvent):void {
	if (e.currentTarget.button == this["btn"+myArray]) {
		trace ("Only button number 3 and 4 will work");
	}
}

Thank you all.

Mark