# Stopping a function

**URL:** https://forum.kirupa.com/t/stopping-a-function/207797
**Category:** Uncategorized
**Created:** [November 21, 2006, 4:45pm UTC](https://forum.kirupa.com/t/stopping-a-function/207797 "2006-11-21T16:45:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![john\_d\_fool](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@john\_d\_fool](https://forum.kirupa.com/u/john_d_fool)
#### Post date: [November 21, 2006, 4:45pm UTC](https://forum.kirupa.com/t/stopping-a-function/207797/1 "2006-11-21T16:45:41Z")

</div>

i have a snow effect in a movie with the code below. i want to stop the effect midway through the movie without stopping the movie. how do i use a stop command to do this?

init = function () {

```
width = 550;
// pixels
height = 400;
// pixels
max_snowsize = 15;
// pixels
snowflakes = 125;
// quantity
for (i=0; i&lt;snowflakes; i++) {

t = attachMovie("snow", "snow"+i, i);
t._alpha = 20+Math.random()*60;
t._x = -(width/2)+Math.random()*(1.5*width);
t._y = -(height/2)+Math.random()*(1.5*height);
t._xscale = t._yscale=50+Math.random()*(max_snowsize*10);
t.k = 1+Math.random()*4;
t.wind = -1.5+Math.random()*(1*3);
t.onEnterFrame = mover;

}

};
mover = function() {

this._y += this.k;
this._x += this.wind;
if (this._y&gt;height+10) {

this._y = -20;

}
if (this._x&gt;width+20) {

this._x = -(width/2)+Math.random()*(1.5*width);
this._y = -20;

} else if (this._x&lt;-20) {

this._x = -(width/2)+Math.random()*(1.5*width);
this._y = -20;

}

}
init();
```
