# Please help me find a way! AS3

**URL:** <https://forum.kirupa.com/t/please-help-me-find-a-way-as3/316938>\
**Category:** Uncategorized\
**Created:** [December 6, 2010, 1:53pm UTC](https://forum.kirupa.com/t/please-help-me-find-a-way-as3/316938 "2010-12-06T13:53:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkRascal](https://avatars.discourse-cdn.com/v4/letter/b/6a8cbe/32.png) [@bkRascal](https://forum.kirupa.com/u/bkRascal)\
**Post date:** [December 6, 2010, 1:53pm UTC](https://forum.kirupa.com/t/please-help-me-find-a-way-as3/316938/1 "2010-12-06T13:53:07Z")

</div>

Hello everybody, A quick and probably stupid question. Im very very new at AS,  
I am using this AS code for a snow effect in a banner… works great!

But, I would like to know how to turn it on and off, and reset it before it loops in the banner. . I have no clue! Tried a few things, but at best I can only stop it.

Any help would be greatly appreciated!!!

Here is the code…

* * *

// SNOWSTORM IN 15 MINS!  
// Author : Seb Lee-Delisle  
// Blog : [www.sebleedelisle.com](http://www.sebleedelisle.com)  
// Company : [www.pluginmedia.net](http://www.pluginmedia.net)  
//  
// This work is licensed under a Creative Commons 2.0 License.

// Full details at  
// [http://creativecommons.org/licenses/by/2.0/uk/](http://creativecommons.org/licenses/by/2.0/uk/)

// You may re-use this code as you wish, but a credit would be  
// appreciated. And I’d love to see what you do with it!  
// mail me : [seb@sebleedelisle.com](mailto:seb@sebleedelisle.com)

import flash.events.Event;  
import flash.geom.Rectangle;

// first make an array to put all our snowflakes in  
var snowFlakes : Array = new Array();

// and decide the maxium number of flakes we want  
var numFlakes : uint = 500;

// and define a rectangle to store the screen dimensions in.  
var screenArea:Rectangle = new Rectangle(0,0,486,60);

// start listening for an ENTER\_FRAME event (the equivalent  
// of the AS2 onEnterFrame function)  
addEventListener(Event.ENTER\_FRAME, frameLoop);

// and define the function that is called on an ENTER\_FRAME event

function frameLoop(e:Event)  
{

```
var snowflake : SnowFlake; 

// if we don't have the maximum number of flakes... 
if(snowFlakes.length&lt;numFlakes)
{
	// then make a new one!
	snowflake = new SnowFlake(screenArea); 
	
	// add it to the array of snowflakes
	snowFlakes.push(snowflake); 
	
	// and add it to the stage
	addChild(snowflake); 
	
}

// now calculate the wind factor by looking at the x position 
// of the mouse relative to the centre of the screen
var wind : Number = ((screenArea.width/2) - mouseX);

// and divide by 60 to make it smaller
wind /=60; 

// now loop through every snowflake
for(var i:uint = 0; i&lt;snowFlakes.length; i++)
{
	
	snowflake = snowFlakes*; 
	
	// and update it
	snowflake.update(wind); 
}

```

}

* * *

Thank you very much in advance!!!

Coz
