[FMX2004PRO]Particle Problems

My little particle system isn’t working too well… :frowning:
If you test the code, you will see that when the particles will stick to the line when they don’t bounce high enough. When they stick to the line, they keep moving in one direction until they reach the end of the line. When the reach, they either fall down really fast or pop up… Can anyone fix this?

Click to make particles

Heres the code:

function setup() {
	this.createEmptyMovieClip("bg", 0);
	bg.lineStyle(1, 0x000066, 100);
	with (bg) {
		moveTo(0, 0);
		beginFill(0x000066, 100);
		lineTo(550, 0);
		lineTo(550, 400);
		lineTo(0, 400);
		lineTo(0, 0);
		endFill();
	}
	this.createEmptyMovieClip("line", 1);
	with (line) {
		lineStyle(10, 0x5F5FFF, 50);
		lineTo(450, 0);
		_x = 50;
		_y = 370;
	}
}
depth = 2;
c = {grav:0.7, friction:3};
colors = [0xABCDEF, 0x0000FF, 0x3333FF, 0x6666FF, 0x789ABC];
setup();
this.onMouseDown = function() {
	go = true;
};
this.onMouseUp = function() {
	go = false;
};
this.onEnterFrame = function() {
	if (go == true) {
		this.createEmptyMovieClip("b"+depth, ++depth);
		b = this["b"+depth];
		particle(b);
	}
};
function particle(b) {
	b.lColor = colors[Math.floor(Math.random()*colors.length)];
	b.vx = Math.random()*3;
	if (random(2) == 1) {
		b.vx = -b.vx;
	}
	b.vy = 0;
	b._x = 275;
	b._y = 0;
	b.onEnterFrame = function() {
		with (b) {
			clear();
			lineStyle(5, b.lColor, 100);
			lineTo(.45, .15);
			vy += _root.c.grav;
			_x += vx;
			_y += vy;
			if (_y>400) {
				this.removeMovieClip();
			}
			if (this.hitTest(_root.line)) {
				vy =-vy;
				vy+=_root.c.friction;
		    	_y = _root.line._y-(_root.line._height/2)+(_height/4);
			}
		}
	};
}