Skip to main content
Participant
May 21, 2006
質問

Moviecliploader with animation

  • May 21, 2006
  • 返信数 1.
  • 222 ビュー
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

2m91_2
Inspiring
May 21, 2006
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
voellmy作成者
Participant
May 21, 2006
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