2 Replies Latest reply on Sep 15, 2009 11:07 AM by JDarling1

    Loading Screen

    JDarling1

      Hello,

       

      I just started working on a preloader screen that includes a preloader mask over a logo and a percentage dynamic text. I can get either or to work but not both at the same time. I notice that if I remove stop(); I can get the percentage to work but not the preloader image. With the stop(); embedded the image preloader works but the percentage doesn't. Any help would be great!

       


      LOADED = Math.round(getBytesLoaded());
          TOTAL = Math.round(getBytesTotal());
          PERCENT = LOADED/TOTAL;
          TEXT = Math.round(PERCENT*100)+"%";
          if (LOADED == TOTAL) {
          gotoAndPlay(3);   
          }
      stop();
      rectMask_mc._height = 1;
      this.onEnterFrame = function():Void {
      var loadedData:Number = this.getBytesLoaded();
      var allData:Number = this.getBytesTotal();
      var percent:Number = Math.round(loadedData/allData*100);
      rectMask_mc._yscale = percent;
      if (loadedData >= allData) {

       

      gotoAndStop(10);
      delete this.onEnterFrame;
      }
      };

        • 1. Re: Loading Screen
          Ned Murphy Adobe Community Professional & MVP

          What you should do is take the percent section and work it into your enterFrame code. Removing the stop() probably make it work because it is free to got a frame and then return which is its basis for updating the percent value.  But if you leave the stop() it cannot return to that frame because it cannot leave it....

           

          Leave the stop in, get rid of the current percent section, and use the bytes loaded and total information within the enterframe section to write out the percent text.  I am assuming you are using the var property of the textfield with TEXT being that var (bad practice though).

           

          stop();
          rectMask_mc._height = 1;
          this.onEnterFrame = function():Void {
          var loadedData:Number = this.getBytesLoaded();
          var allData:Number = this.getBytesTotal();
          var percent:Number = Math.round(loadedData/allData*100);

          TEXT = percent;
          rectMask_mc._yscale = percent;
          if (loadedData >= allData) {

           

          gotoAndStop(10);
          delete this.onEnterFrame;
          }
          };

          1 person found this helpful
          • 2. Re: Loading Screen
            JDarling1 Level 1

            Saweet! that works! Thank you!