6 Replies Latest reply on Oct 3, 2010 12:15 PM by Ned Murphy

    Preloader problem

    Fogfocus

      I am trying to utilize the "Preloader for external file" template in flash cs5 to load my main index.swf as directed in the tutorial with lynda.com. When I test the file the progress bar is there for a beat and then the swf file loads but the progress bar does not go away. The actionscript is pretty simple but I don't see anything that would indicate that the preloader.swf file should go away after the index.swf file has loaded. See below.

       

       

      var contentLoader:Loader;

      loadContent("index.swf");

       

      function loadContent(url:String):void {

      contentLoader = new Loader();

      contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRES S, loading);

      contentLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, contentLoaded);

      contentLoader.load(new URLRequest(url));

      }

       

      function contentLoaded(evt:Event):void {

      //Optionally change to a clip holder and set progressbar visibility.

      addChild(contentLoader);

      }

       

      function loading(evt:ProgressEvent):void {

      var loaded:Number = evt.bytesLoaded / evt.bytesTotal;

      setBarProgress(loaded);

      }

       

      function setBarProgress(value:Number) {

      progressbar.bar.scaleX = value;

      }

      Any thoughts?
      Thanks for your help