5 Replies Latest reply on Apr 18, 2008 6:31 AM by Rothrock

    getBytesTotal() = 12 byte??? HELP

    Alberto Filannino
      I load an external file, the size file is 273.073 byte, but when trace tot the size is 12 byte. Why?

      this.onEnterFrame = function() {
      stop();
      _root.mini_b.loadMovie(_root.Promo);
      //_root.Promo Contains the Movie name
      //_root.mini_b is a clip on the root

      var tot = _root.mini_b.getBytesTotal();
      trace (tot);
      var car = _root.mini_b.getBytesLoaded();
      trace (car);

      if(car==tot) {
      trace ("finish");
      delete this.onEnterFrame;
      }
      }
        • 1. Re: getBytesTotal() = 12 byte??? HELP
          Gum
          What if you place the stop(); at the bottom of your code? Maybe try taking it out of the function. This may make no difference, but it might be worth a try.
          • 2. Re: getBytesTotal() = 12 byte??? HELP
            Rothrock Level 5
            Oh there are so many things wrong with this.

            First move the stop outside of your onEnterFrame. There is no need for it to execute a stop 30 times a second (or whatever your frame rate is). stop will stop you so no need for more.

            Next move your loadMovie outside of the onEnterFrame. Again there is no need to start loading your movie 30 times a second and in fact if you restart 30 times a second you will just keep starting again and again.

            Next you need to be careful because sometimes when a movie first starts to load you can get car and tot to both be zero. So in that case yes they are equal, but no you aren't finished. So add something like

            if(car == tot && tot>12)

            Finally unless you are publishing for Flash 6 or earlier you might want to use the MovieClipLoader class. It wraps up all this checking and stuff in a nice easy wrapper and you can just listen for the onLoadInit event to know that you are ready to go.
            • 3. Re: getBytesTotal() = 12 byte??? HELP
              rlc5611 Level 1
              Rothrock is right about the timing. It often takes Flash time to catch up to your AS. 12 bytes is seen a lot. Either put in extra traps as Rothrock suggests (and you might even need more - especially if components are involved) or else always allow a slight delay after loading begins before you begin checking.
              • 4. Re: getBytesTotal() = 12 byte??? HELP
                Alberto Filannino Level 1
                Thanks. How do I check those data I uploaded if the trace is wrong?
                I need to use Flash 6.
                • 5. Re: getBytesTotal() = 12 byte??? HELP
                  Rothrock Level 5
                  Okay, you can't use MovieClip loader, but everything else I said before that paragraph is the answer.

                  Move stop and loadmovie outside your onEnterFrame and change your conditional to what I said. That should do it.