7 Replies Latest reply on Dec 11, 2010 4:12 PM by kglad

    Preloader does not close after main site has loaded


      Hi guys,


      I know this is a really really basic problem but I'm very new to flash and still dont fully understand AS3.

      I'm using the sample external preloader file supplied with CS5 as the basis for my customised pre-loader. It's working fine except that once the main site has loaded and is open, the preloader remains loaded in the background.


      My code is as follows:



      var contentLoader:Loader;



      function loadContent(url:String):void {

      contentLoader = new Loader();

      contentLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, 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.





      function loading(evt:ProgressEvent):void {

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




      function setBarProgress(value:Number) {

      progressbar.bar.scaleX = value;


      How can I make the pre-loader close itself once the main site has successfully loaded?

      Any help would be really appreciated!