3 Replies Latest reply on Mar 13, 2007 11:48 AM by try.mwang

    Load multiple SWF into MCL

    try.mwang
      Hi.

      Need some help...

      I have a MCL that is loading a large swf file with a preloader...

      The problem I am having is this SWF is large and to load this SWF will take too long LIVE...

      If i break the SWF file into individual swf files, 25 in all (each is an individual image with a simple tween of fade in and fade out. ) What would be the best way to load multiple SWFs into a MCL in succession and then replay once it has gone through the entire rotation.

      current code reads for the large SWF load. I am not sure how to load 5 swfs, one afte another.

      thanks
      ----------
        • 1. Re: Load multiple SWF into MCL
          mclem Level 1
          you could replace the last line of coad with something like this:
          var count:Number = 1;
          myMCL.loadClip("fade" + count + ".swf", "container");

          then create myListener.onLoadComplete

          myListener.onLoadComplete = function (target_mc:Object)
          {
          if (count <= 25)
          {
          count++;
          myMCL.loadClip("fade" + count + ".swf", "container");
          }
          }


          that should keep loading file after file until all 25 are loaded.

          keep in mind though you'll also need 25 empty movieclip targets for all 25 files, otherwise you'll just keep overwrite each previously loaded file with the next file.

          Mark C.

          • 2. Re: Load multiple SWF into MCL
            try.mwang Level 1
            thanks for your input mark...

            I need a little more clarification. excuse me in advance, I am not an actionscript person. I mostly design, but I am trying to get a hang of this. mostly doing tutorials from lynda.com... but this issue was not addresed clearly...anyways...

            when you say I need to have 25 empty MC targets for each SWF, what do you mean by that?

            I input your AS into my action panel... I tweaked it abit for my files to correspond with the AS. The first SWF loads great, when there isn't a 2nd behind it, once the 2nd is added, it overwrites, like you said...

            I guess my question is, how would I create 25 seperate empty MC?

            thanks,
            Mike

            current code---

            var myMCL:MovieClipLoader = new MovieClipLoader();
            var myListener:Object = new Object();

            myMCL.addListener(myListener);

            myListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
            var loaded:Number = Math.round((bytesLoaded/bytesTotal) * 100);
            progressBar.gotoAndStop(loaded);
            }

            myListener.onLoadInit = function (target_mc:MovieClip) {
            progressBar._visible = false;
            }

            myListener.onLoadStart = function (target_mc:MovieClip) {
            progressBar._visible = true;
            }

            var count:Number = 1;
            myMCL.loadClip("fade" + 1 + "discovery.swf", "container");

            myListener.onLoadComplete = function (target_mc:Object)
            {
            if (count <= 25)
            {
            count++;
            myMCL.loadClip("fade" + 1 + "discovery.swf", "container");
            }
            }

            var count:Number = 2;
            myMCL.loadClip("fade" + 2 + "att.swf", "container");

            myListener.onLoadComplete = function (target_mc:Object)
            {
            if (count <= 25)
            {
            count++;
            myMCL.loadClip("fade" + 2 + "att.swf", "container");
            }
            }
            • 3. Re: Load multiple SWF into MCL
              try.mwang Level 1
              mark- forgive my last posting. I added another empty MC and named it, container2.

              when publishing, the fade1discovery.swf loads, but before it finishes, fade2att.swf loads. anyway to control this?