6 Replies Latest reply on Sep 21, 2011 9:22 PM by kglad

    _root.getBytesLoaded();

    Ron Colmen Level 2

      I'm using the code below for my preloader. But the loader is seen after about 60% is being loaded.

       

      How can I make my preloader apperear instantly? (the swf is about 450kb)

       

      loadingBar._xscale = 1;

      var loadingCall:Number = setInterval(preloadSite, 50);

      function preloadSite():Void {

      var siteLoaded:Number = _root.getBytesLoaded();

      var siteTotal:Number = _root.getBytesTotal();

      var percentage:Number = Math.round(siteLoaded/siteTotal*100);

      loadingBar._xscale = percentage;

      _root.percentDisplay.text = percentage + "%";

      if (siteLoaded >= siteTotal) {

      clearInterval(loadingCall);

      gotoAndStop(2);

      }

      }