package { import flash.display.*; import flash.events.*; import flash.net.*; public class NavShoes extends MovieClip { public var nav_mc:MovieClip;// declaring movie clip that houses my buttons public var shoes_mc:MovieClip;// declaring another movie clip //constructor runs all the code u want see at start up remember to close public function NavShoes() { nav_mc.buttonMode=true;// making nav_mc button mode nav_mc.addEventListener(MouseEvent.MOUSE_DOWN,navGate,false,0,true); showContent('nav.swf');// this is what i want loaded on the first page or when the page loads. Its loaded into my function } function navGate(e:MouseEvent) { var temp:String=e.target.name;// this is a temporary variable its going to get the target name of my button var i:Number=temp.indexOf("_");// this will locate the _ in the button name and shorten it to just the name temp=temp.substr(0,i)+ ".swf";//taking the value of temp and adding the the swf prefix. 0 is the starting point and i is where our value is strored. //trace(temp); showContent(temp);//this is accesing our showcontent function and loading the new infomation into it.so whatever the new value of temp is. } function showContent(newFile:String):void // my parameter i passed to this function is caught into newFile and is a string data type { var req:URLRequest=new URLRequest(newFile);//my url request it receives its info from navGate and is saved into newFile var container:Loader=new Loader();//this is my request holder container.load(req);// my holder is loaded with my request but he is still in memory because he has not been added to the display list if(shoes_mc.numChildren>0)// my movie clip sitting on the stage waiting to be loaded. This is checking how many children it has making //sure its above 0 { shoes_mc.removeChildAt(0);// this is saying if its above 0 and a new swf is loaded delete the child in the 0 index } shoes_mc.addChild(container);// add the information in container to the movie clip shoes_mc. container.x=0;// setting the x pos of my container container.y=0;// setting the y pos of my container } } }