Random moving line

im trying to create a random moving line along the x-coordinate that with each cycle will move for a random distance at a random speed. i can generate the ranom distance and speed just fine, but i cant get the speed to apply the movement for then length of the distance. i have tried using a for loop:

for(i = 0; i < distance/speed; i++)

but that creates an extremely fast and rough movement. i need a slow and smooth movement.
any help would be greatly appreciated. here is my code:

onClipEvent (enterFrame) {
	speed = -20 + math.random() * (20 + 20);
	distance = 50 + math.random() * (300 - 50);
	for(i = 0; i < distance/speed; i++){
		_x += speed;

Flash 5: http://www.kirupa.com/developer/actionscript/random.htm

FLash MX: http://www.kirupa.com/developer/mx/random_motionMX.htm

This is not excatly what you are looking for but it might help you in accomplishing what you want. :slight_smile:

yea that isnt exactly what im looking for but in a sense it is i guess. what is want is
http://www.illusionnewmedia.com/INM_Journey.html then go to profile and you will see the lines moving up and down. i want something like that but horizontal. i think that the randommovement tutorial might have what i need, but im having a little trouble breaking it down and pinpointing the bit of code.

hope this helps… i commented it… the code is all within the MCs themselves which are the vertical bars on the stage

yes that did help me, thanks