Loading JPG's

I have a swf with 5 buttons (the number of buttons doesn’t matter).

Each button calls pictLoader to load a jpg and the percentTxt to show the percentage. Everything runs perfectly if I wait each jpg to load completely before clicking other buttons.

But clicking another button to perform a second load by the same Loader before the first one is complete, doesn’t kill this first load. The swf finally shows the right jpg ( the second one ) but the download runs slowly because it is downloading both jpgs.

How to solve this? How to kill the precedents calls?

Excuse me my english !


var pictLoader:Loader = new Loader();
pictLoader.y = 70;
addChild(pictLoader);

var percentTxt:TextField = new TextField();
percentTxt.autoSize = TextFieldAutoSize.LEFT;
percentTxt.y = 50;

var percent:Number;

for (var numBtn:uint = 0; numBtn < 5; numBtn++) {
	var btn_mc:mcBtn = new mcBtn  ;
	btn_mc.name = numBtn.toString();
	btn_mc.x = (btn_mc.width + 10) * numBtn;
	btn_mc.addEventListener(MouseEvent.CLICK, loadPict);
	addChild(btn_mc);
}

function loadPict(event:MouseEvent):void {
	//removeChild(pictLoader);
	var numPict:String = event.currentTarget.name;
	pictLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
	pictLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
	pictLoader.load(new URLRequest("imag/" + numPict + ".jpg"));
	addChild(percentTxt);
}

function onProgress(event:ProgressEvent):void {
	percent = event.currentTarget.bytesLoaded / event.currentTarget.bytesTotal;
	percentTxt.text = Math.ceil(percent * 100).toString();
}

function done(event:Event):void {
	removeChild(percentTxt);
}

Here I click 3 buttons in sequence. As we can see, despite the Loader will show just one jpg ( the last call ) it is downloading 3 !!