# Setting depth with Snow

**URL:** <https://forum.kirupa.com/t/setting-depth-with-snow/268457>\
**Category:** flash\
**Created:** [August 14, 2008, 1:31am UTC](https://forum.kirupa.com/t/setting-depth-with-snow/268457 "2008-08-14T01:31:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![digival](https://avatars.discourse-cdn.com/v4/letter/d/a3d4f5/32.png) [@digival](https://forum.kirupa.com/u/digival)\
**Post date:** [August 14, 2008, 1:31am UTC](https://forum.kirupa.com/t/setting-depth-with-snow/268457/1 "2008-08-14T01:31:21Z")

</div>

So I’m trying to adapt this snow script and its awesome, but how would I put it on the main timeline and swap the depth so that the snow was on a layer beneath another layer?

[COLOR=“Red”] **Here’s the script on the clip:** [/COLOR]  
onClipEvent (load) {  
//specifies the size of the movie stage  
movieWidth = 300;  
movieHeight = 200;

```
//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()*100;
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;  
}  
}

[COLOR=“Red”] **And here’s the script on the main timeline:** [/COLOR]

for (k=0; k\<100; k++) {  
duplicateMovieClip(\_root.snow, “snow”+k, k);  
}

Any help would be super appreciated.
