1 Reply Latest reply on Mar 18, 2007 8:11 AM by Rothrock

    onLoadError

    charlie656 Level 1
      Hi there

      Im building an application that loads a list of other swfs into it. Im using a class to handle all the loading and to allow the user to switch between swfs. Ive created an empty movieclip on the stage for each swf to load into ( ib code ), each clip has seperate MovieClipLoaders and Listeners. I want to attach a fallback clip from the library if a swf doesnt load properly.

      However im having trouble attaching the fallback movieclip, screenLoadingErrorMessage from within the onLoadError event.

      Here's my code

      class ContentLoader
      {
      private function createContentArrays()
      {
      //create a movie clip for every swf thats loaded
      //create MovieClipLoader for every swf thats loaded
      //create Listener for every swf thats loaded

      // create an on load error event to attach error message
      contentListeners .onLoadError = function(target_mc:MovieClip)
      {
      var screenLoadingErrorMessage:MovieClip = target_mc.attachMovie("screenLoadingErrorMessage","screenLoadingErrorMessage",100);

      trace("target_mc: " + target_mc); // ok
      trace("screenLoadingErrorMessage: " + screenLoadingErrorMessage); // undefined
      }
      }

      Can anyone tell me where im going wrong?

      Thanks
        • 1. Re: onLoadError
          Rothrock Level 5
          It is hard to read your code. When you add code to a posting, use the Attach Code button so that the code doesn't get all mucked up.

          I don't think you are doing anything wrong. This is a bug.

          Here is the solution that I came up with (I think thanks to Kglad, but it has been a long time.)

          Basically copy the properties of the existing clip into an object. Get its depth. delete it and then attach.

          This code worked for me and my setup. It might give you some ideas for how to adapt it to your situation.