3 Replies Latest reply on Mar 20, 2007 1:36 PM by liquidleaf

    linked library items via MovieClipLoader?

    liquidleaf Level 1
      So, some of you may have run into this before. I know there is a known issue with importing an SWF to a MovieClip using LoadMovie - in that, any library items in the SWF that have linkage IDs can only be attachMovie'd within the MovieClip itself, and not in the main timeline (or any other timeline).

      However, I'm ok with this limitation.

      I have a project where I'm creating an empty movieclip on the main timeline, called "clip_1".

      I then use a MovieClipLoader object to load an external SWF ("buttons_1.swf") into clip_1.

      This works.

      However, buttons_1.swf has several button clips with linkage IDs set. What I want to do is, after buttons_1.swf has successfully loaded into clip_1, then do something like
      clip_1.attachMovie("btn_play", "play", 1);
      where "btn_play" is the linkage ID of a button in buttons_1.swf.

      This does not work... and it probably should given that apparently some people get a similar thing to work with loadMovie(). I want to use MovieClipLoader, however, because of the built-in error catching and completion features of that class.

      I cannot use the "runtime sharing" workaround for this, because I will have a potentially unlimited, unknown "button" SWFs that will be used. The main movie will load the appropriate button library at runtime, but I can't know in advance what all the libraries will be, and after the main movie is published, ideally I cannot go in and edit it again (want to have it dynamic as possible from the beginning).

      Any help would be appreciated. I know this is a confusing issue.

      (Not sure why this double-posted... sorry about that)
        • 1. Re: linked library items via MovieClipLoader?
          Level 7
          Works for me.


          var mc = this.createEmptyMovieClip("test_mc", this.getNextHighestDepth());
          var mclListener:Object = new Object();
          mclListener.onLoadInit = function(target_mc:MovieClip) {
          // child movie contains MCs with linkage IDs
          // attach an instance of "testclip"
          var _d = target_mc.getNextHighestDepth();
          target_mc.attachMovie("testclip", clip+_d, _d,{_x:30,_y:30});
          };
          var mcl:MovieClipLoader = new MovieClipLoader();
          mcl.addListener(mclListener);
          mcl.loadClip("child.swf", mc);


          • 2. Re: linked library items via MovieClipLoader?
            Level 7
            Oops! Missed some quotes:

            var mc = this.createEmptyMovieClip("test_mc", this.getNextHighestDepth());
            var mclListener:Object = new Object();
            mclListener.onLoadInit = function(target_mc:MovieClip) {
            // child movie contains MCs with linkage IDs
            // attach an instance of "testclip"
            var _d = target_mc.getNextHighestDepth();
            target_mc.attachMovie("testclip", "clip"+_d, _d,{_x:30,_y:30});
            };
            var mcl:MovieClipLoader = new MovieClipLoader();
            mcl.addListener(mclListener);
            mcl.loadClip("child.swf", mc);


            • 3. Re: linked library items via MovieClipLoader?
              liquidleaf Level 1
              You are correct. Turns out my problem was that I was attempting to attachMovie to the wrong object (I was using the "this" keyword incorrectly within the onLoadInit of the MovieClipLoad listener, and of course in that case "this" was the listener, and not the class object that the listener was contained within). Doh.

              It does work!

              Thanks for the reply.