Coding the same thing for multiple mc's

I made an mc which on being hovered makes a wave. The problem is that I can’t think how to apply the code on about 15 mc’s.

I used the main timeline for coding purpose. Now I want to aplly the same waving pattern to the other 14 mc’s. I tried the for loop but couldn’t get it to work because of the variables involved. Can someone help me as I don’t want to code the same thing for 15 mc’s for obvious reasons.

Here’s my code-


k = 100;
t = 0;
ascend = true;
waver = false;
waving = false;
_root.onEnterFrame = function() {
	trace(k + " " + t + " " + ascend + " " + waver + " " + waving);
	_root.wave1.onRollOver = function() {
		waver = true;
		waving = true;
	};
	_root.wave1.onRollOut = function() {
		waver = false;
	};
	_root.wave1.onEnterFrame = function() {
		if (waving == true) {
			if (t < 5000) {
				if (ascend == true) {
					this._yscale += k;
					t += k;
					k--;
				} else {
					this._yscale -= k;
					t -= k;
					k++;
				}
			}
			if (t >= 5000) {
				this._yscale -= k;
				t -= k;
				ascend = false;
			}
			if (t <= 0) {
				waving = false;
				t = 0;
				k = 100;
				ascend = true;
				this._yscale = 100;
			}
		}
	};
};