AS3 external loading plus preloader question (duplicate error)

First of all: Hi

I’ve been messing around in AS3 and I have the following problem; Im trying to have a button load an image and use a pre-loader. It all works fine until I try to get another button going (my_btn2). Then I get a duplicate error.

Im terrible at AS3, can someone take a look.


import fl.controls.ProgressBar;


var myLoader:Loader = new Loader();


var my_pb:ProgressBar = new ProgressBar();
my_pb.source = myLoader.contentLoaderInfo;
my_pb.x = 100;
my_pb.y = 200;


my_btn.addEventListener(MouseEvent.CLICK, startLoading);
function startLoading(e:MouseEvent):void{
myLoader.load(new URLRequest("专卖店.swf"));
addChild(my_pb);
removeChild(my_btn);
my_btn=null;
}


my_btn2.addEventListener(MouseEvent.CLICK, startLoading);
function startLoading(e:MouseEvent):void{
myLoader.load(new URLRequest("专卖店.swf"));
addChild(my_pb);
removeChild(my_btn2);
my_btn2=null;
}

myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishLoading);
function finishLoading(e:Event):void{
addChild(myLoader);
removeChild(my_pb);
my_pb = null;
}