イベントが startLoad メソッドに到着したときに e.target から取得したボタンを無効にすると、コードの動作が改善されます。次に、swf ごとに onCompleteHandler メソッドを区別すると、対応するボタンを再び有効にする機会が得られます。
私はあなたのボタン クラスについて何も知らないので、それを YourButtonClass と呼びます。disable(); と書きます。および enable(); 以下の例では、ボタンのメソッドを無効化および有効化しています。それらを適切な正しいクラス名メソッドまたはプロパティ設定に置き換えてください。また、e.target クラスとボタンをチェックすることで、不必要な悲劇を回避できます。
function startLoad(e:MouseEvent){
var mLoader:Loader; // we havent seen the river, lets not inflate our boat.
var mRequest:URLRequest;
if(!(e.target is YourButtonClass)) return; // no nightmares..
if((e.target != btnOne)&&(e.target != btnTwo))return; // no nightmares..
YourButtonClass(e.target).disable(); // disable the button here
mLoader = new Loader(); // river! inflate the boat :)
if (e.target == btnOne){
mRequest = new URLRequest("appOne.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteAppOne);
}
else { // we are sure it is btnTwo if not btnOne now...
mRequest = new URLRequest("appTwo.swf");
mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onCompleteAppTwo);
}
mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgressHandler);
mLoader.load(mRequest);
}
// this method is for enabling btnOne
protected function onCompleteAppOne(Event: e){
btnOne.enable();
commonCompleteOperations(e);// if you have other operations post processing
}
// this method is for enabling btnTwo
protected function onCompleteAppTwo(Event: e){
btnTwo.enable();
commonCompleteOperations(e);// if you have other operations post processing
}
// this method is for on complete common operations if you have.
protected function commonCompleteOperations(Event e){
// do some processing here, for instance remove event listener check for
// application domain etc...
}
念のため、セキュリティ エラー イベントと io エラー イベントをリッスンします。どちらのエラー イベントも、ボタン/ファイルごとに 1 つのハンドラ メソッドで処理できます。