Hello,

I have created a website which loads external swfs as pages onto the main stage on the click of a button. I am using Flash CS3 and Actionscript 3.0.

Here is my code:

Code:
var Xpos:Number = 0;
var Ypos:Number = 0;
var swf:MovieClip;
var loader:Loader = new Loader();

var defaultSWF:URLRequest = new URLRequest("swfs/basherimage.swf");

loader.load(defaultSWF);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Btns Universal function
function btnClick(event:MouseEvent):void {

removeChild(loader);
var newSWFRequest:URLRequest = new URLRequest("swfs/" + event.target.name + ".swf");
loader.load(newSWFRequest);
loader.x = Xpos;
loader.y = Ypos;
addChild(loader);

}
// Btn listeners
photos.addEventListener(MouseEvent.CLICK, btnClick);
vid.addEventListener(MouseEvent.CLICK, btnClick);
bio.addEventListener(MouseEvent.CLICK, btnClick);
resume.addEventListener(MouseEvent.CLICK, btnClick);
contact.addEventListener(MouseEvent.CLICK, btnClick);
Now however, I would like the defaultSWF (basherimage) to not be removed when the swfs: bio, resume, or contact load. I only want it to be removed if the swfs: photos or vid load.

Basically, I think that I need to add a code that says something like this:

if bio swf, resume swf, or contact swf loads, also load basherimage swf, if its not already loaded. if basherimage swf is already loaded do not remove.

if photos swf or vid swf loads, remove basherimage swf.

How can I write this in actionscript code? Could someone help me out? Or point me to a tutorial? All help is appreciated greatly! Thank you!