How To Remove Listener

hi everyone,

I have no idea how to remove a listener.
The script below is an instance where i have 2 buttons on stage.

When i click btn1, it will load an image, while it is loading,
if i click btn2, i want it to remove the listener and delete the URL request.

but what i currently have can’t achieve that.
I know ther’s something wrong at my else statement, but no idea how to phrase it.

can anyone help??

basically i want the image to stop loading when i click btn2.
THanks in advance guys




import flash.events.MouseEvent;

btn1.addEventListener(MouseEvent.CLICK,thumbClick1);
btn2.addEventListener(MouseEvent.CLICK,thumbClick2);

function thumbClick1(evt:MouseEvent):void {
loadImage(0);
}

function thumbClick2(evt:MouseEvent):void {
loadImage(1);
}

function loadImage(something:Number) {
if (something == 0) {
var objLoader:Loader = new Loader();
var objFileToLoad:URLRequest = new URLRequest(“http://people.mozilla.com/~faaborg/files/20061210-newCar/newCar.jpg_large.jpg”);
objLoader.load(objFileToLoad);
objLoader.contentLoaderInfo.addEventListener(Event.INIT, imageLoaded);
objLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);

	function imageLoaded($event:Event):void {
		this.addChild(objLoader);
	}
	function showProgress($event:ProgressEvent):void {
		trace(Math.round(($event.bytesLoaded / $event.bytesTotal) * 100) + " percent loaded so far...");
	}
} else {
	objLoader.contentLoaderInfo.removeEventListener(Event.INIT, imageLoaded);
	objLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, showProgress);
}

}