# Creating snowflakes in AS2 and placed them behind a mc

**URL:** <https://forum.kirupa.com/t/creating-snowflakes-in-as2-and-placed-them-behind-a-mc/310722>\
**Category:** Uncategorized\
**Created:** [June 17, 2010, 3:22pm UTC](https://forum.kirupa.com/t/creating-snowflakes-in-as2-and-placed-them-behind-a-mc/310722 "2010-06-17T15:22:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fedeque](https://avatars.discourse-cdn.com/v4/letter/f/e79b87/32.png) [@Fedeque](https://forum.kirupa.com/u/Fedeque)\
**Post date:** [June 17, 2010, 3:22pm UTC](https://forum.kirupa.com/t/creating-snowflakes-in-as2-and-placed-them-behind-a-mc/310722/1 "2010-06-17T15:22:51Z")

</div>

Hi there,

I am new in this forum, so first things first. Hello to everybody.

I am using a code downloded here in Kirupa, this code makes snowflakes, but place them in front of every layer.

I have to show a mc in front of the snow and I don´t know how to write it in the code below.

If anyone can help me out, I will really apreciate it. Thanks a lot

Fede

Here is the code

w = Stage.width;  
h = Stage.height + 100;  
max\_snowsize = 15;  
snowflakes = 200;

init = function ()  
{  
for( i = 0; i \< snowflakes; i++ )  
{  
t = attachMovie(“snow”, “snow”+i, i);  
t.\_alpha = 50 + Math.random()_50;  
t.\_x = -(w_0.5) + Math.random()_(1.5_w);  
t.\_y = -(h_0.5) + Math.random()_(1.5_h);  
t.\_xscale = t.\_yscale = 50 + Math.random()_(max\_snowsize_10);  
t.k = Math.random()1.5 + 1;  
t.wind = Math.random()3.5 - 1.5;  
t.onEnterFrame = mover;  
}  
}  
mover = function ()  
{  
this.\_y += this.k;  
this.\_x += this.wind;  
if(this.\_y \> h+10)  
{  
this.\_y = -20;  
}  
if(this.\_x \> w+20)  
{  
this.\_x = -(w0.5) + Math.random()(1.5_w);  
this.\_y = -20;  
}  
else if(this.\_x \< -20)  
{  
this.\_x = -(w_0.5) + Math.random()_(1.5\*w);  
this.\_y = -20;  
}  
}  
init();
