8 Replies Latest reply on Dec 20, 2009 4:46 AM by Ned Murphy

    Help with unloading images AS3


      Please can anyone help me. I am new to Action Script and flash and am having a nightmare unloading images. The code below works but I keep getting the following error messages:



      TypeError: Error #2007: Parameter child must be non-null.

      at flash.display::DisplayObjectContainer/removeChild()

      at index_fla::MainTimeline/clickSection()




      ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.

      at flash.display::DisplayObjectContainer/removeChild()

      at index_fla::MainTimeline/clickSection()


      Any help with this would be much appreciated.



      var ImgReq01:URLRequest=new URLRequest("images/home/01.jpg");

      var ImgReq02:URLRequest=new URLRequest("images/home/02.jpg");

      var ImgReq03:URLRequest=new URLRequest("images/home/03.jpg");

      var ImgReq04:URLRequest=new URLRequest("images/home/04.jpg");

      var ImgReq05:URLRequest=new URLRequest("images/home/05.jpg");


      var imgList:Array=[ImgReq01,ImgReq02,ImgReq03,ImgReq04,ImgReq05];


      var imgRandom = imgList[Math.floor(Math.random()* imgList.length)];


      var imgLoader:Loader = new Loader();


      imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);





      function onComplete(event:Event):void


        var randomImage:Bitmap = Bitmap(imgLoader.content);









      //handle events for info buttons...

      information. addEventListener (MouseEvent.CLICK, clickSection);

      home. addEventListener (MouseEvent.CLICK, clickSection);

      galleries. addEventListener (MouseEvent.CLICK, clickSection);

      function clickSection (evtObj:MouseEvent) {

      //Trace shows what's happening.. in the output window

      trace ("The "+evtObj.target.name+" button was clicked")

      //go to the section clicked on...

      gotoAndStop (evtObj.target.name)


      // this line is causing errors when navigating between the gallery and information buttons

      var Image:Bitmap = Bitmap(imgLoader.content);