Click to See Complete Forum and Search --> : Unloading duplicateMovieClip created MCs


jacobdesch
08-31-2007, 02:23 PM
I found this really great tutorial on how to make really nice looking flash snow here:

http://www.kirupa.com/developer/mx/snow.htm

It uses the duplicateMovieClip method to create about 50 pieces of falling snow. Works great. The only problem is that I can't get it to stop snowing! I only need it to snow for a portion of my movie and then go away. I've done a little reading and found that to do it, you use the removeMovieClip command, but I don't know exactly the duplicateMovieClip function names its created instances, so I'm having trouble making them go away. Essentially, this is the code that creates the movie clips of the snow to fall:

on (release) {
for (k=0; k<50; k++) {
duplicateMovieClip(this.snow, "snow"+k, k);
}
}

I thought of doing it this way, but it doesn't seem to work:

removeMovieClip(this.snow1);
removeMovieClip(this.snow2);
removeMovieClip(this.snow3);
removeMovieClip(this.snow4);
removeMovieClip(this.snow5); etc...etc....up to 50 (the maximum number of Movie Clips created)

or this way:

this.snow1removeMovieClip;
this.snow2removeMovieClip;
this.snow3removeMovieClip;
this.snow4removeMovieClip;
this.snow5removeMovieClip;etc...etc....

I'm fairly unfamiliar with both of these functions, so I'm pretty sure I'm just missing something simple when it comes to instance names. Does anyone have any suggestions? Thanks in advance.

Webjedikungfu
09-27-2007, 12:16 AM
It is a simple fix, I don't know that tutorial but you can:

Create a new movieclip instance
Bring in all layers of the tutorial so everything is in the new container movieclip.
Place it on stage after you create it
Give it an instance name of "snowingMovieCLip"

Then just say anywhere you want in your timeline:
snowingMovieCLip.stop();

// or

snowingMovieCLip.play(); // to play again

Hope that makes sense, and if you keep the actionscript layer and everything intact within "snowingMovieCLip" this approch should be really simple.