This Works! But Why?

Hey all,

I have code that loads an external .swf files into my main.swf. Each of the external .swf files has a close out button. When that button is clicked, it calls a function that supplies close out animations for the movie clips for any .swf that is loaded. All code is in main.swf. There is no code in the external.swf(s)

Here’s the kicker…

Each external .swf has it’s own set of movie clips. The “closeCurrentSWF” function has animations for movie clips that are within .swf files that may not even be loaded, yet I get NO errors when this function is called…which is great!!

I’m so stoked this works, I just need help understanding why flash isn’t throwing me an error…

[COLOR="Gray"]//Load External SWF//////////////////////////////////////////////[/COLOR]
var _swfContainer:Loader = new Loader()

_swfContainer.contentLoaderInfo.addEventListener(Event.COMPLETE, finishedLoading);

stage.addChild(_swfContainer);

var _externalMovie:MovieClip;

function loadSWF(nameOfSWF:String){
_swfContainer.load ( new URLRequest( nameOfSWF ) );
}

[COLOR="gray"]// This is done after the swf is loaded[/COLOR]
function finishedLoading (e:Event){
_externalMovie = MovieClip(_swfContainer.content);

[COLOR="gray"]//Upon executing the "finishedLoading" function, we can now assign events to the movie clips within the external swf's[/COLOR]
_externalMovie.panel.btnClose.buttonMode=true;
_externalMovie.panel.btnClose.addEventListener(MouseEvent.CLICK, closeCurrentSWF);

}
[COLOR="gray"]//End Load External SWF//////////////////////////////////////////////[/COLOR]

nav.btnInfo.addEventListener(MouseEvent.CLICK, loadInfo);
nav.btnPortfolio.addEventListener(MouseEvent.CLICK, loadPortfolio);

btnFS.addEventListener(MouseEvent.CLICK,fullScreenUP);

function closeCurrentSWF(e:MouseEvent):void{
	
	Tweener.addTween(_externalMovie.panel, {alpha:0, time:2, delay:0, transition:"easeInOutExpo"})
	Tweener.addTween(_externalMovie.panelInfoPic, {alpha:0, time:2, delay:1, transition:"easeInOutExpo"});
	Tweener.addTween(_externalMovie.panelPortfolioVid, {alpha:0, time:2, delay:1, transition:"easeInOutExpo"});
	Tweener.addTween(_externalMovie.panelPortfolioPic, {alpha:0, time:3, delay:1, transition:"easeInOutExpo"});		
}
	

function loadInfo(e:MouseEvent):void{
		loadSWF("panelInfo.swf");
		
}

function loadPortfolio(e:MouseEvent):void{
		loadSWF("panelPortfolio.swf");
}


[COLOR="gray"]/////////////// TOGGLE FULL SCREEN/////////////////////////////////
// Boolean variable set for use below in our function[/COLOR]
var screenCheck:Boolean = false;
[COLOR="gray"]// These three lines keep stage elements the same size, so they don't distort[/COLOR]
var swfStage:Stage = this.stage;
swfStage.scaleMode = StageScaleMode.NO_SCALE;
swfStage.align = StageAlign.TOP;


function fullScreenUP(event:MouseEvent):void { 

	if(_externalMovie  != null){ [COLOR="gray"]//this prevents a null return error if btnFS is clicked when no SWF is loaded.[/COLOR]
		Tweener.addTween(_externalMovie.panel, {y:350, time:1, delay:0, transition:"easeInOutExpo"});
	}

      if (screenCheck == false) {

            stage.displayState = StageDisplayState.FULL_SCREEN;
			screenCheck = true;
			btnFS.txtFS.visible=false;
			btnFS.txtNS.visible=true;
			
			Tweener.addTween(nav, {y:639, time:1, delay:0, transition:"easeInOutExpo"});
			Tweener.addTween(btnFS, {y:40, time:1, delay:0, transition:"easeInOutExpo"});
			Tweener.addTween(mcTF, {x:-220, time:1, delay:0, transition:"easeInOutExpo"});
			
			
          } else {
			  
			 stage.displayState = StageDisplayState.NORMAL;
			 screenCheck = false;
			 btnFS.txtFS.visible=true;
			 btnFS.txtNS.visible=false;
			 
			 	if(_externalMovie  != null){
					Tweener.addTween(_externalMovie.panel, {y:267, time:1, delay:0, transition:"easeInOutExpo"});
				}
			 
			 Tweener.addTween(nav, {y:549, time:1, delay:0, transition:"easeInOutExpo"});
			 Tweener.addTween(btnFS, {y:20, time:1, delay:0, transition:"easeInOutExpo"});
			 Tweener.addTween(mcTF, {x:35, time:1, delay:0, transition:"easeInOutExpo"});

		  }

}
[COLOR="gray"]///////////////////////////END TOGGLE FULL SCREEN///////////////////////////////[/COLOR]