1 Reply Latest reply on Jun 27, 2009 10:21 PM by kglad

    Preloading main site swf and intro swf within one preloader?

    FizixRichard

      Hi,

       

      I have a full flash website which is broken down into:

       

      - Main movie which contains navigation and interface components

      - Several content movies which are loaded into the main movie on demand

      - An intro movie which is around 3MB in size; its a full CG movie.

       

       

      At the moment the main movie preloads and then the intro movie preloads afterwards in a sequence; like so:

       

      Main Movie > Intro Movie > Content Loads

       

      There is a skip intro option which will skip the intro movie step and jump right to the content load once the main movie has loaded.

       

       

      My client wants me to do something which is proving very difficult and I am starting to wonder if its even possible as searches on the net have given results which don't really work properly.

       

       

      Here is what I need to do:

       

      When the main movie is requested, its preloader appears which it has a load bar and a "skip intro" button. The difference being, this preloader will be loading the main movie AND the preloader; which the load bar representing both movies load progress.

       

      To complicate matters, if the skip intro button is pressed, the preloader needs to drop the intro movie from the equation and just account for the main movie & thus skip the intro; straight to the content.

       

       

      The way I have tried to do it is to have a preloader code in the intro which sends the total size and bytesloaded back to the main movie which deals with those values, adding it onto its own size. This is proving cumbersome and although appeared to be working, isn't working propery.

       

       

      Is there an easier way of doing it?

      Can someone point me to a solution to this problem?

       

       

      Thanks

        • 1. Re: Preloading main site swf and intro swf within one preloader?
          kglad Adobe Community Professional & MVP

          in your main swf, if you're loading the intro into introTargetMC (and if, when you skip the intro you remove this movieclip), you can use:

           

          var tl:MovieClip = this;
          var preloadI:Number;
          var bt:Number;
          var bl:Number;

           

          preloadI=setInterval(preloadF,100);

           

          function preloadF(){
          bt = tl.getBytesTotal();
          bl = tl.getBytesLoaded();
          if(introTargetMC){
          bt+=introTargetMC.getBytesLoaded();
          bl+=introTargetMC.getBytesTotal();
          }
          pctLoaded = Math.round(100*bl/bt);
          if(bl==bt){
          clearInterval(preloadI);
          }
          }

           

          skipIntroBtn.onRelease=function(){

          introTargetMC.removeMovieClip();  //<-make sure at removeable depth

          }