How can i stop a function?

i have this title screen with some falling leaves, similar to the snow present here in kirupa. the problem is, when the scene is now in the gameplay, there still some falling leaves, how can i make this function stop.

The simplest way I can think of is put your code in an if - else statement, with a boolean. Something like:


if(!cutscene)
{
      //your snow code

}
else
{
    //remove snow
}


Then when you enter the cutscene, set cutscene to true. The code you would use to remove the snow depends on how you’re creating it.

i get your point, but the code seems to look a bit ahm… un accurate, can u think of another method.
by the way here is the code:

//snow function

snowfall = function () {

width = 800;
// pixels
height = 600;
// pixels
max_snowsize = 10;
// pixels
snowflakes = 50;
// quantity
for (i=0; i<snowflakes; i++) {

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

}

};
mover = function() {

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

this._y = -20;

}
if (this._x>width+20) {

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

} else if (this._x<-20) {

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

}

}
snowfall();

//end of snow function

or you could just use unloadMovie

thank you very much joex4, you really helped me alot… also to others who helped me here…

another thing…

how can i make the background scroll, do you want me to show the fla for you t create an engine.???

If you want to pause it just do
mySnowClip.onEnterFrame = null

when you want to stop it and set it back when you want to make it go again