[AS 2.0] EXPERT Assoc. Array Help: Accessing MovieClip vs. non-MovieClips

I’m currently working through a tutorial that builds an interval manager class. This interval manager class is specifies custom setInterval and clearInterval functions that enable the normal _global.setInterval and _global.clearInterval methods to call a function located in any object, and also to call that fucnction in any scope. It uses an associative array to store references to the objects in which the custom setInterval is called so that they can be cleared at later time.

Question: When adding items to this associative array, the custom setInterval function specifies two ways for creating references for its associative array. One way is is used to create references for MovieClips, and the other way is for non-MovieClips. Why is this necessary? The tutorial states that you must first create an ID for the non-Movie Clip references, but I don’t understand why this extra step is necessary.

Here is the class file code:


class com.oop.managers.IntervalManager {
	
	static private var __listeners:Object = {};
	static private var __intervalID:Number = 0;
	
	function IntervalManager() {};
	
	static public function setInterval(connection:Object, intName:String, path:Object, func:String, time:Number):Void {
		clearInterval(connection, intName);
		if (connection instanceof MovieClip) {
			if(__listeners[connection] == undefined) {
				__listeners[connection] = {};
			}
			__listeners[connection][intName] = _global.setInterval(path, func, time, arguments[5], arguments[6], arguments[7], arguments[8], arguments[9], arguments[10]);
		} else {
			if(connection.intervalID == undefined) {
				connection.intervalID ="int" + (__intervalID++);
			}
			__listeners[connection.intervalID] = {};
			__listeners[connection.intervalID][intName] = _global.setInterval(path, func, time, arguments[5], arguments[6], arguments[7], arguments[8], arguments[9], arguments[10]);
		}
	}
	static public function clearInterval(connection:Object, intName:String):Void {
		if(connection instanceof MovieClip) {
			_global.clearInterval(__listeners[connection][intName]);
		} else {
			_global.clearInterval(__listeners[connection.intervalID][intName]);
		}
	}
}