3 Replies Latest reply on Nov 28, 2007 11:37 AM by kglad

    Preloader Help

    NDempewolf
      Hello,

      I have two swf movies: em2400Template.swf & em2400demo.swf
      em2400demo.swf loads into em2400Template.swf

      I have created a preloader on the first frame of the em2400demo.swf movie and have attached the following actionscript snippet…

      -----------


      stop();
      _root.holder_mc.loadingBar_mc._xscale = 1;
      var loadingCall:Number = setInterval(preloadSite, 50);
      function preloadSite():Void {
      var siteLoaded:Number = _root.holder_mc.getBytesLoaded();
      var siteTotal:Number = _root.holder_mc.getBytesTotal();
      var percentage:Number = Math.round(siteLoaded/siteTotal*100);
      loadingBar_mc._xscale = percentage;
      _root.holder_mc.percentClip.percentDisplay.text = percentage + "%";
      _root.holder_mc.percentClip._x = loadingBar_mc._x + loadingBar_mc._width;
      _root.holder_mc.bytesDisplay.text = "loaded " + siteLoaded + " of " + siteTotal + " bytes";
      if (siteLoaded >= siteTotal) {
      clearInterval(loadingCall);
      gotoAndStop(3);
      }
      }

      -----------

      em2400demo.swf loads fine, but the text that displays the percentage and bytes loaded/total bytes is not displaying. Sample of the file is located HERE Click on the 'View Demo' button to view the em2400demo.swf file.

      Your assistance with this is greatly, greatly appreciated!
        • 1. Re: Preloader Help
          kglad Adobe Community Professional & MVP
          use the trace function to check that your path.name to your textfield is correct. if it is correct is your textfield visible on-stage and does it need an embedded font?
          • 2. Re: Preloader Help
            NDempewolf Level 1
            Thanks for the assistance. I managed to get it figured out. Corrected the target paths (listed below):

            ---------------

            stop();
            _root.holder_mc.loadingBar._xscale = 1;
            var loadingCall:Number = setInterval(preloadSite, 50);
            function preloadSite():Void {
            var siteLoaded:Number = _root.holder_mc.getBytesLoaded();
            var siteTotal:Number = _root.holder_mc.getBytesTotal();
            var percentage:Number = Math.round(siteLoaded/siteTotal*100);
            _root.holder_mc.loadingBar._xscale = percentage;

            _root.holder_mc.percentClip.percentDisplay.text = percentage + "%";
            trace("Percentage is Working");


            _root.holder_mc.percentClip._x = _root.holder_mc.loadingBar._x + _root.holder_mc.loadingBar._width;

            _root.holder_mc.bytesDisplay.text = "loaded " + siteLoaded + " of " + siteTotal + " bytes";
            trace("Site Loaded is Working");

            if (siteLoaded >= siteTotal) {
            clearInterval(loadingCall);
            gotoAndStop(5);
            }
            }

            ---------------

            Text field was visible, font just needed to be embedded. As a note I placed a dynamic text box that spec'd _sans as the font with the 'use device fonts' option picked. I had to respec a different font and embed it into the swf.

            Thanks again for the assistance!
            • 3. Re: Preloader Help
              kglad Adobe Community Professional & MVP
              you're welcome.