2 Replies Latest reply on Jul 8, 2010 6:38 AM by Kwangle

    How Do I Target a Loaded Movieclip?

    Kwangle

      Hi All,

       

      I have been loading a movies into container object called 'hold' using:

       

      movLoader = new MovieClipLoader();
      //creates listener object
      movListen = new Object();
      //links listener to loader
      movLoader.addListener(movListen)

       

      //function runs when ad completes load
      movListen.onLoadComplete = function(target) {
      trace("Target is "+target);
      };
      movLoader.loadClip("http://www.mysite.com/myMovie.swf",hold);

       

      The movie successfully loads the container object, but it has a stop() action on frame 1 becuase I don't want it to play until it is activated. I want to be able to target the loaded movie when I want it to play, but no instance name has been applied - so how do I target it?

       

      When I trace the target it reports that the target is the container object  - presuambly the 'target' argument of the onLoadComplete function always refers to the container object  that the movie is loaded into. Is there a way I can find tname of content inside the holder or assign an instance name so I can target it or is there a simpler method of achieving this?

       

      Having uploaded loaded movies onto external servers and having the parent movie clip as a local file also seems to affect the success of targetting, which is a bit confusing.

       

      Any ideas or help with these issues would be very helpful - thanks.

        • 1. Re: How Do I Target a Loaded Movieclip?
          Ned Murphy Adobe Community Professional & MVP

          You should be able to target the loaded movie using either "target" or "hold".  One thing you might consider changing is to use onLoadInit rather than onLoadComplete.  onLoadInit indicates when the loaded movie is done loading AND is set up and ready to use.

          1 person found this helpful
          • 2. Re: How Do I Target a Loaded Movieclip?
            Kwangle Level 1

            Thanks for that. The tip about onLoadInit is a good one and well worth remembering but I am still a little confused about the targetting issue.

             

            Surely the container object (in this case 'hold') is a separate movie from the content that is loaded into it, and the content is a child of the container? Does the container object have to be an empty movie clip which effectively vanishes when something is loaded into it with the loaded movie inheriting the instance name of the container and replacing the container? Or does the container and the loaded movie both exist after the load has completed?

             

            Thanks for your help.