# Snow tutorial

**URL:** <https://forum.kirupa.com/t/snow-tutorial/20831>\
**Category:** Uncategorized\
**Created:** [May 13, 2003, 10:30pm UTC](https://forum.kirupa.com/t/snow-tutorial/20831 "2003-05-13T22:30:57Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanman918](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@sanman918](https://forum.kirupa.com/u/sanman918)\
**Post date:** [May 13, 2003, 10:30pm UTC](https://forum.kirupa.com/t/snow-tutorial/20831/1 "2003-05-13T22:30:57Z")

</div>

Hey, I’m trying to edit the snow tutorial that is on Kirupa because I want to make a bubble like effect. I’m not so strong when it comes to the .math section of actoinscript. So if someone could just tell me what I have to edit to make the bubbles go up instead of down it would help 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 14, 2003, 8:53pm UTC](https://forum.kirupa.com/t/snow-tutorial/20831/2 "2003-05-14T20:53:52Z")

</div>

this is my action script i have on my movie clip called snow. I currently have it flowing upwards like bubbles but they spawn to high in the movie? Any ideas?

onClipEvent (load) {  
// specifies the size of the movie stage  
movieWidth = 140;  
movieHeight = 244;  
// variables that will modify the falling snow  
i = 1+Math.random()\*2;  
k = -Math.PI+Math.random()\*Math.PI;  
// giving each snowflake unique characteristics  
this.\_xscale = this.\_yscale=50+Math.random()\*50;  
this.\_alpha = 75+Math.random()\*100;  
this.\_x = -10+Math.random()\*movieWidth;  
this.\_y = -10+Math.random()\*movieHeight;  
}  
onClipEvent (enterFrame) {  
// putting it all together  
rad += (k/180)\*Math.PI;  
this.\_x -= Math.cos(rad);  
this.\_y -= i;  
if (this.\_y\>=movieHeight) {  
this.\_y = -5;  
}  
if ((this.\_x\>=movieWidth) || (this.\_x\<=0)) {  
this.\_x = -10+Math.random()\*movieWidth;  
this.\_y = -5;  
}  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 17, 2003, 7:18pm UTC](https://forum.kirupa.com/t/snow-tutorial/20831/3 "2003-05-17T19:18:51Z")

</div>

I hope you already figured it out, but just in case…

Attached is the source file from the tutorial with the corresponding modifications. 😉  
And you might want to take a look at [this](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=16380=bubbles) thread too… 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 17, 2003, 7:58pm UTC](https://forum.kirupa.com/t/snow-tutorial/20831/4 "2003-05-17T19:58:22Z")

</div>

thanks a bunch Kax…you da actionscript masta

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 17, 2003, 8:02pm UTC](https://forum.kirupa.com/t/snow-tutorial/20831/5 "2003-05-17T20:02:59Z")

</div>

> _Originally posted by sanman918_  
> **thanks a bunch Kax**

No problem. =)

> _Originally posted by sanman918_  
> **you da actionscript masta**

Yeah, sure… 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 19, 2003, 11:31pm UTC](https://forum.kirupa.com/t/snow-tutorial/20831/6 "2003-05-19T23:31:58Z")

</div>

i got a couple more questions. 1 can i have it so all the bubbles spawn down at the bottom. 2. I’m loading bubbles.swf onto a movie and the frame speed is 12 fps but the one for the bubbles needs to be about 25 so what do I do? and 3rd. I want to load 2 copies of bubbles.swf one on the left and one on the right…how would I do that? Thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2003, 12:43am UTC](https://forum.kirupa.com/t/snow-tutorial/20831/7 "2003-05-20T00:43:49Z")

</div>

Ok, if I understood your questions… 😛

1. Change the depth of the bubbles or the movieclip holding the bubbles to a lower depth. 🙂

2. You could change the enterFrame event handler with a function, then use setInterval so it’s executed faster than the fps. 😉

3. Just create two movieclips and place one on the left and one on the right? 😛

Is that what you asked? :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2003, 1:22am UTC](https://forum.kirupa.com/t/snow-tutorial/20831/8 "2003-05-20T01:22:21Z")

</div>

1. Most of the bubbles spawn at the bottom of the movie but some spawn all the way up top.
2. Need a little more explaination if you don’t mind 🙂
3. I try that but everytime I load through an empty movie clip it messes up for some reason. I can try again though.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2003, 2:14am UTC](https://forum.kirupa.com/t/snow-tutorial/20831/9 "2003-05-20T02:14:21Z")

</div>

1. It makes no sense at all… if there is any symbol in the same depth than any of the duplicated bubbles, it would be replaced by the bubble. :-  
I’d like to see the FLA if you don’t mind… 😉

2. Ok… I’ll attach a FLA later, just give me some time, i’m really busy right now. :-\

3. Again, I can’t tell what’s wrong without taking a look at your FLA.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2003, 4:49am UTC](https://forum.kirupa.com/t/snow-tutorial/20831/10 "2003-05-20T04:49:37Z")

</div>

well im using the bubble .fla you gave me. And this isn’t just once with the load through an empty movie clip command it screws up. I’m loading it just fine and the action script is just perfect. Like I have a clock I made for a counter that is 3 seperate text fields that are dynamic. I view .swf by its self and its perfect. It reads 0:00 and its starts to count 0:01 but when I load it though a movieclip is gets all messed up like 0:0101 and you can scroll over the text and it only counts to 0:09 and then goes back to 0:00 instead of 0:10. But the .swf is perfect on its on and is just find when I load it right into the root level. But when I load through emptymovieclip its messed.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2003, 4:59am UTC](https://forum.kirupa.com/t/snow-tutorial/20831/11 "2003-05-20T04:59:45Z")

</div>

Ehmm… surely there’s an addressing issue. :-\

Can you post your script? 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 20, 2003, 11:01pm UTC](https://forum.kirupa.com/t/snow-tutorial/20831/12 "2003-05-20T23:01:39Z")

</div>

well the thing that is most important to his scene is the bubbles. So could you please go into more detail how to make the frame rate different for a .swf I have loaded into my scene?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 21, 2003, 6:19am UTC](https://forum.kirupa.com/t/snow-tutorial/20831/13 "2003-05-21T06:19:31Z")

</div>

Sorry… I’ve been really busy. :-\

```auto
onClipEvent (load) {
	movieWidth = 300;
	movieHeight = 200;
	i = 1+Math.random()*2;
	k = -Math.PI+Math.random()*Math.PI;
	this._xscale = this._yscale=50+Math.random()*100;
	this._alpha = 75+Math.random()*100;
	this._x = -10+Math.random()*movieWidth;
	this._y = movieHeight-this._height;
	move = function () {
		rad += (k/180)*Math.PI;
		_x -= Math.cos(rad);
		_y -= i;
		if (_y<=-_height) {
			_y = movieHeight-_height;
		}
		if (_x>=movieWidth || _x<=0) {
			_x = -10+Math.random()*movieWidth;
			_y = -5;
		}
		updateAfterEvent();
	};
	setInterval(move, 1000/25);
}

```

=)
