I'm aware of Begoners thread, but that isn't the same as this because this thread actually covers random movement.
What I am going to explain is how to make a movie clip move around the stage randomly, changing direction every few seconds.
So, what you are going to do is make two variables on the chosen movie clip. One of the variables will handle a _x location while the other handles a _y location. The movie clip will determine it's speed/direction (velocity) by taking the _x variable (which will be random) from it's current _x location, and the _y variable (random again) from it's current _y position.
Code
Here is my code which will cause the movie clip to move about the stage randomly.
onClipEvent (load) {
speed = 60
//You can change that to suit your flash best
//A higher speed will make the MC move slower
function getPoints() {
getX=random(550), getY=random(400);
//get 2 numbers, one for the _x axis and one for the _y
//Change 550 and 400 to the maximum _x and _y for your flash
gotoX=(getX-_x)/speed, gotoY=(getY-_y)/speed;
//declaring the speed and direction (velocity)
clearInterval(id);
id = setInterval(getPoints, random(2000)+500);
//make the amount of time in between change in direction random.
}
id = setInterval(getPoints, 1000);
getX=random(550), getY=random(400);
}
onClipEvent (enterFrame) {
_x += gotoX, _y += gotoY;
//move
}
Links:
Example
Another tutorial (much harder + does the same thing)
Google: Random Movement
Any questions?
Sup, bitches :)