Help load swf in anther swf.TypeError: Error #2007: Parameter child must be non-null

Hi guys

I’ve searched the forum but couldn’t get the answer as to why when I load my page (SWF1) into my layout (SWF2), I get this error in the flash player

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.controls::Button/draw()
    at fl.core::UIComponent/callLaterDispatcher()

When I compile SWF1 in Flash CS4, I get no problems whatsover (SWF1 BY ITSELF SHOWS PERFECT). So i’m guessing the problem is when it needs to add SWF1 to SWF2’s display object container. I remember reading somewhere else on a forum that it might by the fact that i’m loading the SWF1 display objects into SWF2 before SWF2 has a stage???. They said that I needed to insert this code into my main document class before I add anything to the stage, which I did do, but still not working.


public class Main extends Sprite{
   public function Main():void{
            if(stage==null){
                addEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
            }else{
                onAddedToStage();
            }
   }
        
   private function onAddedToStage(event:Event=null):void{
            removeEventListener(Event.ADDED_TO_STAGE,onAddedToStage);
            stage.scaleMode="noScale";
            ....AND THE REST OF MY CODE IS HERE
   }
}

You can check the website here (SWF2 is embed in this html) http://www.runwayaustralia.com.au/layout.html[URL=“http://www.runwayaustralia.com.au/layout.html”]

When you click any title in the navigation, it loads a swf into the box. All load perfectly at the moment but I have designed a new swf for the Workshop page. The reasons I believe all the pages so far work but not my new page is that all previous pages I designed in actionscript, I never used classes and did it all on one page, yeah pretty crazy true. Now that i am much better at actionscript and am using classes, extending class and using the document class in this new swf design, I have now encountered this error.

Here is SWF1 (the new Workshop page) by itself, ready to embed, but I can’t get it to work. The forms are all working so if you fill them out, it will go to the client, so please don’t.

http://runwayaustralia.com.au/content4new.swf

What happens in the flash player, is that when I click Workshop in the navigation, which is linking to content4new.swf, the error box pops up before anything shows, saying the error message above. I click continue and it reappears about 4 times, after I click continue to all, just the image and text displays (which is all non-actionscript). All actionscript like the forms and buttons, do not display.

Can I have any help on this issue as it is really important. By looking at the website i’ve designed it might seem that I know a fair bit but I don’t. I only know how to do what I need to do so I might’ve missed some real important techniques, so please excuse me if i ask some stupid questions. I’m sorry I have no actionscript to show but this is a client so I really wouldn’t like to disclose all the actionscript for the page as it is owned by the client. If you really need to see the actionscript to help me, let me know and I will take out private information from the code and insert generic details.

Thankyou