I have One SWF loading Two External SWFs seprately that have dataGrid components in them. The Externals load and run fine on their own but when I try to load them into CORE SWF I get …
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/addChildAt()
at fl.controls::BaseButton/drawBackground()
at fl.controls::LabelButton/draw()
at fl.core::UIComponent/drawNow()
at fl.controls::DataGrid/drawList()
at fl.controls::DataGrid/draw()
at fl.core::UIComponent/callLaterDispatcher()
Here is the AS3 Code for the CORE SWF:
//* 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);
/*aClip.addEventListener(MouseEvent.MOUSE_OVER, handleOver);
bClip.addEventListener(MouseEvent.MOUSE_OVER, handleOver);*/
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);
}