Flash Script – Falling Snow Effect

Tweet


type = 'application/x-shockwave-flash'
data = 'http://sitepointstatic.com/flash/snow.swf'
width = '400'
height = '400'
bgcolor = 'black'
>

Download the sample files here.

1. Create a small snowflake I used a small circle filled with white color.

2. Convert this snowflake object to a movie clip, and give it an instance name of "snow".

3. Now, go in to the time line of this snow movie clip, and create three keyframes in this layer.

4. In the first key frame give action:

mov = 0; 
ran = getProperty("", _x);

5. In the second key frame give action:

setProperty ("", _y, mov=mov+2); 
snowy = getProperty("", _y);
setProperty ("", _x, (ran+random(2)));
if(snowy > 310)
{
setProperty ("", _y, 50);
mov=0;
ran = ran - 10;
}

6. In the third key frame give action:

gotoAndPlay (2);

7. Now go back to the main timeline, and create two key frames in this layer.

8. Insert these actions into the first key frame:

if (snowparticles<150) 
{
duplicateMovieClip("snow","snow" add i,i)
scale=random(60)+10
setProperty("snow" add i,_x,random(450))
setProperty("snow" add i,_xscale,scale)
setProperty("snow" add i,_yscale,scale)
snowparticles++
i++
}

9. Insert this action into the second key frame:

gotoAndPlay (2);

That’s it! You have created your own snow effect.

Get your free chapter of Level Up Your Web Apps with Go

Get a free chapter of Level Up Your Web Apps with Go, plus updates and exclusive offers from SitePoint.

  • Jay Svoboda

    how do you add a clickTAG action to this snow effect? Can i add it to the existing auto script? or do i need to create a new button / layer and add the action to that?