I have one SWF loading two external SWFs (CORE loads PE and RE swfs). Separately the PE and RE run pefectly fine. However when I try to load into the CORE SWF I get:
Actionscript Code:
TypeError: Error #2007: Parameter child must be non-null.
I have been looking at this for three days and cannot see where I am going wrong. Please Help
Here is the CORE Code:
Code:
//* MAKE BUTTONS STAY ACTIVE WHEN CLICKED *//
var aClip:MovieClip = this.getChildByName("a_mc") as MovieClip;
var bClip:MovieClip = this.getChildByName("b_mc") as MovieClip;
var hash:Dictionary = new Dictionary();
aClip.addEventListener(MouseEvent.CLICK, handleClick);
bClip.addEventListener(MouseEvent.CLICK, handleClick);
var selected:MovieClip = aClip;
selected.gotoAndStop(10);
/*
trace("selected");*/
function handleClick(e:MouseEvent):void
{
var target:MovieClip = e.currentTarget as MovieClip;
if (target != selected)
{
selected.gotoAndStop(1);
selected = target;
selected.gotoAndStop(5);
}
}
//* ALL ABOUT LOADERS *//
var swfholder:Loader=new Loader();
a_mc.addEventListener(MouseEvent.CLICK, loadLeg);
b_mc.addEventListener(MouseEvent.CLICK, loadHouse);
swfholder.load(new URLRequest("04_23_pensions_pe.swf")); //starts movie with Pensions loaded
swfholder.contentLoaderInfo.addEventListener(Event.COMPLETE, onSwfLoaded)
function onSwfLoaded(event:Event):void //prepares Retirees loader, removes Pensions
{
this.addChild(swfholder);
swfholder.x =5;
swfholder.y =125;
swfholder.width =885;
swfholder.height =430;
b_mc.addEventListener(MouseEvent.CLICK, loadHouse);
a_mc.removeEventListener(MouseEvent.CLICK, unloadthis);
}
function loadLeg(event:MouseEvent):void
{
this.addChild(swfholder);
swfholder.load(new URLRequest("04_23_pensions_pe.swf")); //loads Legislature swf
swfholder.x =0;
swfholder.y =0;
swfholder.width =880;
swfholder.height =308;
b_mc.addEventListener(MouseEvent.CLICK, unloadthis);
a_mc.removeEventListener(MouseEvent.CLICK, loadLeg);
}
function loadHouse(event:MouseEvent):void
{
this.addChild(swfholder);
swfholder.load(new URLRequest("04_23_pensions_re.swf")); //loads House swf
swfholder.x =0;
swfholder.y =0;
swfholder.width =880;
swfholder.height =308;
b_mc.removeEventListener(MouseEvent.CLICK, loadHouse);
a_mc.addEventListener(MouseEvent.CLICK, unloadthis);
}
function unloadthis(event:Event):void
{
removeChild(swfholder);
a_mc.addEventListener(MouseEvent.CLICK, loadLeg);
b_mc.addEventListener(MouseEvent.CLICK, loadHouse);
}