Avoid attacching code in a object

Hi everybody,
Macromedia says “…Avoid attaching code in a object…”.
The question is: how to integrate this code to the code of the main timeline? Thanks.

This is the code inside a the MovieClip named “dot”:


removeMe = function () {
	clearInterval(countDown);
	this.removeMovieClip();
};
var countDown = setInterval(this, "removeMe", timer);

This is the code in the main timeline:


function drawGrid(theWidth, theHeight, imageClip) {
	var initDot = new Object();
	var k = 0;
	// Create a mask clip to hold all the dots
	this.createEmptyMovieClip("mask", 1);
	// Assign it as the masking clip
	imageClip.setMask(mask);
	for (var i = 0; i<theWidth; i += 4) {
		for (var j = 0; j<theHeight; j += 4) {
			var dotName = "dot"+i+"_"+j;
			initDot._x = i;
			initDot._y = j;
			initDot.timer = 1000+Math.ceil(Math.random()*800);
			// Place the masking dots within the container mask clip
			mask.attachMovie("dot", dotName, k, initDot);
			k++;
		}
	}
}
drawGrid(200, 200, image1_mc);