Unable to clearInterval correctly

I am creating a preloader using setInterval, and so far so good. The only problem I am having is clearing the interval’s ID name:


_global.queryload = function(clip, intervalname) {
	clip.bytes_loaded = Math.round(clip.getBytesLoaded());
	clip.bytes_total = Math.round(clip.getBytesTotal());
	trace(clip.bytes_loaded + " / " + clip.bytes_total);
	if ( clip.bytes_loaded == clip.bytes_total ) {
		clearInterval(intervalname);
		trace(intervalname);
	}
}

container.loadMovie("catnap.jpg");

preloader = setInterval(queryload, 500, container, preloader);

The bytes_loaded and bytes_total information is being traced back correctly. However when I do a trace for the ‘preloader’ ID, it returns “undefined”.

I have a feeling that I am not identifying the preloader ID correctly when I clear it, or when I pass it to another function.

Any hints?