2 Replies Latest reply on May 21, 2006 2:41 PM by voellmy

    Moviecliploader with animation

    voellmy
      Hello eveyone,

      I went to http://www.gotoandlearn.com/ and did the tutorial on "External SWF Preloading". Now, in that tutorial, external SWF-files are loaded with the MovieClipLoader. The good thing that I love is that the loader is in the main file and doesn't have to be included in all of the external SWFs. The problem is that the tutorial only covers how to indicate the progress with a dynamic text field. Instead, what I want to do for my own website is to use a movieclip or an animation, of a circle being filled more as the progress reaches 100%. I found a tutorial on flashkit where there was a circle in a movieclip, and over 100 frames there was a mask revealing more of the circle as the loading progressed. However, that was a real preloader, not controlled with the same kind of actionscript as the one I went through. So my question is, how can I do that with this actionscript? Lets say that I have a movieclip, and inside that is a circle on one layer, and on top of that layer is another layer with a mask. The animation is "stop motion" and uses 100frames. How can I use that instead of the "percent.text" that I have posted here:

      var mcl:MovieClipLoader = new MovieClipLoader();

      var mclL bject = new Object();

      mclL.onLoadProgress = function(target,loaded,total) {
      loader.percent.text = Math.round((loaded/total) * 100) + "%";
      }

      mclL.onLoadInit = function() {
      loader._visible = false;
      loader.percent.text = "";
      }

      mcl.addListener(mclL);

      mcl.loadClip("swf1.swf",holder);

      b1.onRelease = function() {
      loader._visible = true;
      mcl.loadClip("swf1.swf",holder);
      }

      b2.onRelease = function() {
      loader._visible = true;
      mcl.loadClip("swf2.swf",holder);
      }

      Now, I need to call a gotoAndStop method within the onLoadProgress event handler. How do i do that?
      Im not sure how to do this. This is one of my tries..:

      mclL.onLoadProgress = function(target,loaded,total) {
      loader.percent.text = Math.round((loaded/total) * 100) + "%";
      mc_circle.gotoAndStop(percent);
      }

      I've also tried it with _root. in front of mc_circle without any luck. and finally "loader.mc_circle.gotoAndStop(percent);"
      because i figured that "loader" was the instance name of the clip in which the mc_circle is placed. Im still not getting this right though.

      Thanks in advance. I really hope I was able to explain my problem properly.
        • 1. Re: Moviecliploader with animation
          2m Level 2
          mclL.onLoadProgress = function(target,loaded,total) {
          loader.percent.text = Math.round((loaded/total) * 100) + "%";
          mc_circle.gotoAndStop(Math.round((loaded/total) * 100));
          }

          And yes you did a great job explaining your problem!

          M
          • 2. Re: Moviecliploader with animation
            voellmy Level 1
            Thanks a lot 2m!

            A first it didn't work. I had to add "loader." in front of mc_circle, since the clip is inside another clip called "loader". That's because I need to hide the entire clip called "loader" when the loading is finished.

            Here is the fix for everyone to see:
            loader.mc_circle.gotoAndStop(Math.round((loaded/total) * 100));

            Thanks again M!

            -M