Help with snow tutorial

Hey Kirupa,

First off thank you for your tutorials. The snow one is especially great. I have a problem with it though.

Well a few problems. First how do I tell it to spawn the snow flakes from
somewhere other than the top right? Can I make them spawn in a little box in
the middle of the page?

My main problem right now is that I have your snow on my loading screen, but
when I get into my site how do I make the movie stop? I want it to stop
snowing.

Also is there anyway to make it so that the snow isn’t the top most layer?

If you could help me that would be grand.

Thank you,
mastawok

Assuming you are using this tutorial… http://www.kirupa.com/developer/mx/snow.asp (as you didn’t state which tutorial you used, and there are I think 2 on this site)

Well a few problems. First how do I tell it to spawn the snow flakes from
somewhere other than the top right? Can I make them spawn in a little box in
the middle of the page?

Well of course you can change the spot, but that will ruin the effect. The tutorial relies on having the clips spread apart on the _x axis and the moving down on the _y axis. Then once the clip gets to the bottom, it puts it back up top at another random _x axis location. So starting it from one single point wouldn’t work too well.

My main problem right now is that I have your snow on my loading screen, but
when I get into my site how do I make the movie stop? I want it to stop
snowing.

The power of removeMovieClip(). You can use a variable to let it know when to delete itself.

Fine this line…

if (this._y>=movieHeight) {
		this._y = -5;
	}

That is the line that makes it set itself back at the top when it is all the way at the bottom. You can do something like this now…

if (!_root.done) {
		if (this._y>=movieHeight) {
			this._y = -5;
		}
	} else {
		this.removeMovieClip();
	}

Where _root.done is a variable and it is looking if _root.done is false, it sends it back to the top, or else it removes the movie clip. Now all you have to do is when you are ready, either on a button or a later frame have

_root.done = true;

It will read it as true, then as the if statement says, it will remove the movie clip if _root.done is not false.

There is a problem with this… it leaves 1 clip behind, I have no clue why man.

But you can also do a more realistic effect, as if it stopped snowing when it was done… you can do it by changing that area of code to say…

if (this._y>=movieHeight) {
		if (!_root.done) {
			this._y = -5;
		} else {
			this.removeMovieClip();
		}
	}

That way when you set the _root.done to true, it will wait until it hits the bottom to remove the movie clip, giving the effect a more clean exit. The snow falls slow sometimes though, so yeah… :-\

Ok…

Also is there anyway to make it so that the snow isn’t the top most layer?

No. Sorry.