1 Reply Latest reply on Mar 16, 2010 10:24 PM by kglad

    Preloader idiot

    Btphoto86

      Hey,

       

      I am terrible at Actionscript. I shouldn't use it, but because I built my enitre site in Flash I need to use it. I need to create a preloader that when it's done loading,  the loading bar dissapears and a Enter button appears.It's loading the entire site, and I'm using 2.0.


      stop();
      onEnterFrame = function(){
           if (_root.getBytesLoaded() == _root.getBytesTotal()){
                delete onEnterFrame;
                gotoAndStop(2);
           }
      }

      That is what I'm using to load my enitre site. It works, but of course there is no loading bar and I have no idea how to attach one. Further more you can tell it jumps to frame two when what I really want is for it to bring up an Enter button so the viewer can choose when to enter and go to frame 2.

       

       

      Hope this all makes sense. Thanks for the help.

        • 1. Re: Preloader idiot
          kglad Adobe Community Professional & MVP

          create an enter button, place it on-stage and give it an instance name (say enterBtn).  you'll disable its visible property until loading is complete and your preloader is removed so, take that into account.

           

          for your loading bar, create a movieclip that contains a rectangle stroke with a fill.  convert the fill to a movieclip (with registration point along its left edge) and assign an instance name (say fillMC).

           

          you can then place your loading bar on-stage and give it an instance name (say loadbarMC).  you can then use:

           

          enterBtn._visible=false;
          enterBtn.onRelease=function(){
          this._visible=false;
          gotoAndStop(2);
          }
          loadbarMC.fillMC._width=0;

          stop();
          onEnterFrame = function(){
          loadbarMC.fillMC._width = _root.getBytesLoaded()*loadbarMC._width/_root.getBytesTotal();
               if (_root.getBytesLoaded() == _root.getBytesTotal()){
                    delete onEnterFrame;
          loadbarMC.swapDepths(getNextHighestDepth());
          loadbarMC.removeMovieClip();
          enterBtn._visible=true;
               }
          }