Skip navigation
Currently Being Moderated

loader to reach 100% after loading several SWFs?

May 24, 2012 6:41 AM

How do I make the loader reach 100% when all a.swf, b.swfs, c.wfs and d.swf completes loading?

 

prototypeLDR.addListener(prototypeLO);

var swfsLoaded:Number=0;

var prototypeLDR:MovieClipLoader = new MovieClipLoader();

var prototypeLO:Object = {}; prototypeLDR.addListener(prototypeLO);

 

prototypeLO.onLoadInit = function(targetMC2:MovieClip){

          swfsLoaded++;

          if(swfsLoaded==4){

                    for (i=1; i<5; i++) {

                              _root.vest_mc["mcA"+i+"_mc"]._visible=false;

          }

          _root.loaderBar2._visible = false;

          _root.borderX2._visible = false;

          _root.loaderBack2._visible = false;

          _root.gotoAndPlay(9);

          }

}

 

prototypeLO.onLoadStart = function(targetMC2) {

          _root.loaderBar2._visible = true;

          _root.borderX2._visible = true;

          _root.loaderBack2._visible = true;

};

 

prototypeLO.onLoadProgress = function(targetMC2, lBytes, tBytes) {

          _root.loaderBar2._width = (lBytes/tBytes)*100;

          _root.percentDisplayZ.text = "% "+Math.round((lBytes/tBytes)*100);

};

 

btn.onRelease = function() {

                     prototypeLDR.loadClip("www.web.com/myfile/a.swf,_root.main1_mc);

                    prototypeLDR.loadClip("www.web.com/myfile/b.swf,_root.main2_mc);

                    prototypeLDR.loadClip("www.web.com/myfile/c.swf,_root.main3_mc);

                    prototypeLDR.loadClip("www.web.com/myfile/d.swf,_root.main4_mc);

//do more...

}

 
Replies
  • Currently Being Moderated
    May 24, 2012 8:31 AM   in reply to Ron Colmen

     

    You need a variable that is the sum of the total bytes of all your SWF and one that has the count of bytes loaded for use in instead of lBytes and Tbytes

     

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 8:29 AM   in reply to Ron Colmen

    One approach would be to make the bar width total change 25% for each file.

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 11:50 AM   in reply to Ron Colmen

    bytes_loaded=Math.round(loaderA.getBytesLoaded()+loaderB.getBytesLoade d()+loaderC.getBytesLoaded()+loaderD.getBytesLoaded());

    bytes_total=Math.round(loaderA.getBytesTotal()+loaderB.getBytesTotal() +loaderC.getBytesTotal()+loaderD.getBytesTotal());

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 12:26 PM   in reply to Ron Colmen

    Only if you make it be invisible 4 times.  I wouldn't.

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 1:45 PM   in reply to Ron Colmen

    Just move the lines that make it invisible outside of any function so that it is only invisible at the start.  As soon as it is made visible the first time it will stay visible.

     
    |
    Mark as:
  • Currently Being Moderated
    May 24, 2012 2:36 PM   in reply to Ron Colmen

    You can add a counter

     

    var counter:int=0;

     

     

    prototypeLO.onLoadProgress = function(targetMC2, lBytes, tBytes) {

              _root.loaderBar2._width = (lBytes/tBytes)*100;

              _root.percentDisplayZ.text = "% "+Math.round((lBytes/tBytes)*100);

             if(++counter>=4){

                    

               _root.loaderBar2._visible = false;

              _root.borderX2._visible = false;

              _root.loaderBack2._visible = false;

                }

    };

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points