Unload xml... or death

Hi,

I’m pretty new to AS3 and I’ve been banging my head against this problem for so long death seems an easy way out. So remember, if you help you may just save a life tonight! I’m trying to unload a swf and replace with another, which I’ve done successfully but in this situation it involves children talking to parents and communication has broken down. Families eh?

Basically, I’ve created a global map, whereby on clicking a country-level button, that country’s swf is loaded into an empty MC (called REGIONContainer). So, for the example of Canada below:

WorldMap.RegionCanada.addEventListener(MouseEvent.CLICK, buttonClickCanada);
function buttonClickCanada(event:MouseEvent):void{
var my_loader:Loader = new Loader();			
				REGIONContainer.addChild(my_loader);
				my_loader.load(new URLRequest("REGION-CANADA.swf"));
	}, 

A ‘mini-globe map’ in the corner was used to navigate between country swfs, removing any already loaded swfs and replacing. So Canada’s nav button is:

WorldMap.mapZoom.mapZoomCanada.addEventListener(MouseEvent.CLICK, MapZoomClick3);
function MapZoomClick3(e:MouseEvent):void{

	while(REGIONContainer.numChildren > 0)
{
	REGIONContainer.removeChildAt(0);
}
		var my_loader:Loader = new Loader();
		my_loader.load(new URLRequest("REGION-CANADA.swf"));
		REGIONContainer.addChild(my_loader);
		defaultRegionName = "CANADA";
}

Everything works and I was happy until here. I’ve just been told that a further level is needed… so, in the example above, within CANADA.swf, there will be more buttons to load up other swfs, this time at state level, (e.g. BRITISH-COLUMBIA.swf)

My problem is, as these buttons are inside the CANADA.swf, which sits inside REGIONContainer, how can I strip CANADA.swf out and replace with BRITISH-COLUMBIA.swf? I’ve tried all sorts and most of the info I’ve found on the net has confused me further. I’m meant to be on holiday for xmas but I’m up at 3am trying to fix this, any help will put you on Santa’s nice-list guaranteed :slight_smile: