3 Replies Latest reply on May 26, 2009 9:54 PM by kglad

    What's the Best Method? Daisychain SWF's or create single?

    Derrick Wells

      I'm not looking for code at this point, I am simply looking for feedback on the best way to do the following...

       

      I have created a series of Flash animations that I would like to string together to play one after another either by a  simple click (at end of one movie to play another) or by automatically moving to next movie once one another is complete.

       

      Here's my question.... Is it better to...

       

      • Turn each individual movie into a movie symbol and import all symbols into a sinlge timeline that simply goes frome frame 1 to frame 2, etc? (Basically creating a single FLA and SWF file from many)... or...
      • Create a "Pre-load" module that pre-loads all the different .swf files into the player so that when they move from one swf to the next there in no delay or hiccup as the next movie loads?... or...
      • Is there a better option entirely?

       

      My goal was to creat a bunch of mini-animations that would be individual FLA and SWF files that I can plug and play as necessary. Keeping everything modulized so changes can be made easily to a particular segment without have to create a bulky and complex single FLA. My problem with this is when it is time to go to the next movie I get a delay as the next movie loads and the look is NOT seamless due to this delay.

       

      Thank you for your thoughts.

       

      Derrick

        • 1. Re: What's the Best Method? Daisychain SWF's or create single?
          kglad Adobe Community Professional & MVP

          in your situation it's better to load the swfs and preload them before starting.  that way it's much easier to add, remove and change "modules".

          1 person found this helpful
          • 2. Re: What's the Best Method? Daisychain SWF's or create single?
            Derrick Wells Level 1

            Good news. That's what I was hoping for. Now the tricky part.

             

            I'm thinking that I will place the "pre-loader" code within the first swf (segment) but I've only had luck pre-loading the same movie that the pre-loader code is within (and no luck preloading multiple movies that are not part of original movie).

             

            What would the code (Actionscript 2) look like if I was to put that preloader in the first loading movie but have it preload a series of 5 or 6 other swf's?

             

            Would you like me to take a crack at it and have you tell me where I'm wrong or is it easier for you (or someone) to simply give me sample code?

             

            Thank you!!!

             

            Derrick

            • 3. Re: What's the Best Method? Daisychain SWF's or create single?
              kglad Adobe Community Professional & MVP

              the best way to handle loading external swfs is to insert an empty frame at the first frame and then attach stop() to that frame.  you can then use:

               

               

              var tl:MovieClip = this;
              var dep:Number = 0;
              var swfA:Array = ["firstswftoload.swf","2ndswftoload.swf","3rdswf.swf",...];
              var targetA:Array = [];
              var numLoaded:Number = 0;
              var numPlaying:Number = 0;
              
              var mcl:MovieClipLoader = new MovieClipLoader();
              var lo:Object = new Object();
              lo.onLoadInit=function(target:MovieClip){
                   numLoaded++;
                   if(numLoaded<swfA.length){
                        loadNextSWF();
                   } else {
                        playNextSWF();
                   }
              }
              lo.onLoadProgress=function(target:MovieClip,bl:Number,bt:Number){
              fractionLoaded = bl/(bt*swfA.length)+numLoaded/swfA.length;
              // use fractionLoaded for your preloader display
              }
              mcl.addListener(lo); loadNextSWF(); function loadNextSWF(){      var targetMC:MovieClip = tl.createEmptyMovieClip("targetMC_"+dep,dep++);      mcl.loadClip(swfA[numLoaded],targetMC); } function playNextSWF(){      if(numPlaying<swfA.length){           targetA[numPlaying].play();           targetA[numPlaying].onEnterFrame=function(){                if(this._currentframe==this._totalframes){                     numPlaying++;                     setTimeout(playNextSWF,1);                     this.removeMovieClip();                }           }      } }