1 Reply Latest reply on Mar 22, 2007 10:35 AM by Sway_foru

    Multiple Preloaders

    JLgraphicFX
      My web site is comprised of an introduction SWF that contains a movie as well as buttons to load several other SWFs at the choice of the viewer. I created a preloader SWF, comprised of the following code, to load the introduction SWF into it:

      var myMCL:MovieClipLoader = new MovieClipLoader();
      var myListener:Object = new Object();
      myMCL.addListener(myListener);
      myListener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
      var loaded:Number = Math.round((bytesLoaded/bytesTotal) * 100);
      progressBar.gotoAndStop(loaded);
      }
      myListener.onLoadInit = function (target_mc:MovieClip) {
      progressBar._visible = false;
      loading._visible = false;
      }
      myListener.onLoadStart = function (target_mc:MovieClip) {
      progressBar._visible = true;
      loading._visible = true;
      }
      myMCL.loadClip("portfolio-1-intro.swf", "SWFcontainer");

      The preloader for the Introduction SWF works fine. It displays a progress bar and disappears when the Introduction is loaded. However, I am really having trouble coming up with the code for a preloader for the other SWFs (they contain large files) that get loaded from the buttons in the loaded Introduction SWF. Do I put this same preloader and code in each SWF that I want to load or do I write code to call the movie clip loader in the original preloader and change the SWF name to be loaded? I tried both ways and neither worked.

      I am a graphic designer and am new (obviously ;) ) at writing Actionscript. I would really appreciate help with this.