# Dynamic event handlers

**URL:** https://forum.kirupa.com/t/dynamic-event-handlers/209342
**Category:** Uncategorized
**Created:** [December 7, 2006, 9:00pm UTC](https://forum.kirupa.com/t/dynamic-event-handlers/209342 "2006-12-07T21:00:48Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dotCom\_flasher](https://avatars.discourse-cdn.com/v4/letter/d/97f17d/32.png) [@dotCom\_flasher](https://forum.kirupa.com/u/dotCom_flasher)
#### Post date: [December 7, 2006, 9:00pm UTC](https://forum.kirupa.com/t/dynamic-event-handlers/209342/1 "2006-12-07T21:00:48Z")

</div>

So I found this really great snow effect (on this site actually), but its coded for flash 5. Because of the onClipEvent (enterFrame) code, I can’t make it stop after 15 seconds. Well, I don’t know HOW to make it stop after 15 seconds. does anyone? if not, can someone help me throw this code into a function so that I can apply a getTimer(); to it and stop it after 15 seconds?

Heres the code:

onClipEvent (load) {  
//variables  
width = 305;  
height = 250;  
//random x,y, and alpha  
this.\_xscale = this.\_yscale=50+Math.random()_100;  
this.\_alpha = 20+Math.random()50;  
//random x and y for flakes  
this.\_x = -width+Math.random()(3_width);  
this.\_y = -10+Math.random()\*height;  
//speed and trigonometric value  
i = 1+Math.random()\*2;  
k = -Math.PI+Math.random()_Math.PI;  
rad = 0;  
}  
onClipEvent (enterFrame) {  
// horizontal movement  
rad += (k/180)Math.PI;  
xmovement = \_root.\_xmouse;  
this.\_x -= Math.cos(rad)+(xmovement-(width/2))/50;  
// vertical movement  
this.\_y += i;  
// remove clips when they misbehave (overstep boundaries)  
if (this.\_x\>(width+50)) {  
this.\_x = -45;  
this.\_y = Math.random()height2;  
}  
if (this.\_x\<-50) {  
this.\_x = width+45;  
this.\_y = Math.random()height2;  
}  
if (this.\_y\>=height) {  
this.\_y = -50;  
this.\_x = -width+Math.random()(3_width);  
}  
}
