# Flyng pollen (another problem)

**URL:** <https://forum.kirupa.com/t/flyng-pollen-another-problem/309992>\
**Category:** flash\
**Created:** [May 29, 2010, 3:41pm UTC](https://forum.kirupa.com/t/flyng-pollen-another-problem/309992 "2010-05-29T15:41:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nene\_86](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@nene\_86](https://forum.kirupa.com/u/nene_86)\
**Post date:** [May 29, 2010, 3:41pm UTC](https://forum.kirupa.com/t/flyng-pollen-another-problem/309992/1 "2010-05-29T15:41:57Z")

</div>

Hi everyone!  
I’m using the tutorial to create falling snow for flying pollen but I can’t make the particles move horizontally. They go straight on from the bottom to the top of the stage. It’s not good.

This is the code:  
onClipEvent (load) {  
//specifies the size of the movie stage  
movieWidth = 900;  
movieHeight = 600;

//random x,y, and alpha  
this.\_xscale = this.\_yscale=50+Math.random()\*75;  
this.\_alpha = 25+Math.random()\*100;

//random x and y for flakes  
this.\_x = -10+Math.random()\*movieWidth;  
this.\_y = -10+Math.random()\*movieHeight;

//speed and trigonometric value  
i = 1+Math.random()\*2;  
k = -Math.PI+Math.random()\*Math.PI;  
}

onClipEvent (enterFrame) {  
// horizontal movement  
rad += (k/180)\*Math.PI;  
this.\_x -= Math.cos(rad);  
// vertical movement  
this.\_y -= i;

if (this.\_y\<=-5) {  
this.\_y = Stage.height + 5;  
}  
if ((this.\_x\>=movieWidth) || (this.\_x\<=0)) {  
this.\_x = -10+Math.random()\*movieWidth;  
this.\_y = Stage.height + 5;  
}  
}

Thanks =)
