2 Replies Latest reply on Apr 3, 2011 9:25 PM by sagaro

    Help with Error 2007 Loading External SWFs

    strongma2akron

      I am just learning ActionScript3 and am trying to create a fla file that loads 3 external SWF. I have already created and saved the 3 SWFs and they are all saved in the same folder. I have given them the names "A.swf" "B.swf" and "C.swf" so they are easy for me to keep track of. I created the actionscript below and placed it in the first frame of my parent file which is saved in the same folder.

       

      import flash.display.MovieClip;
      import flash.display.Loader;

      var swfContainer:MovieClip;
      var swfLoader:Loader = new Loader();
      swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,loaderCompleteHandler);

      function loaderCompleteHandler (evt:Event):void {
      swfContainer = swfLoader.content as MovieClip;
      addChild (swfContainer);
      swfContainer.x = 0;
      swfContainer.y = 0;
      swfContainer.alpha = 1;
      swfContainer.visible = true;
      }

      swfLoader.load(new URLRequest ('A.swf'));

       

      When I incert the filename in the URLRequest statement "A.swf" and test the movie it works loading the swf movie and playing it.

      When I swap either the "B.swf" or "C.swf" file names in the place of the "A.swf" it doesn't work. I end up with no swf file loaded or played on the stage. I also get the following error statement. But I am confused because it is in the Output Tab not the Error Tab which does not report any errors.

       

      TypeError: Error #2007: Parameter child must be non-null.
      at flash.display::DisplayObjectContainer/addChild()
      at SWFadMovieClips_fla::MainTimeline/loaderCompleteHandler()

       

      I have looked through the programming book I got from the local library and it has not been very helpful. Although I shouldn't be too surprised as it is written for use with CS.3 and I am using CS.5. Regardless, I am stalled out. Any help or advice would be greatly appreciated. Eventually my goal is to create one fla file which loads and plays in succession the three separate swf files in one package.