random target 1: setting a random target for the _x property

onClipEvent(load ){
// initialize the Xtarget variable
// and set it to a random number
// between 0 and 300
var Xtarget = random(301);
}
onClipEvent(enterFrame ){
// if the horizontal position of the instance
// is to the right (greater than) the target value,
// then move it to the left one pixel.
// if the instance is to the left (less than) the target value,
// then move it to the right.
// if the instance is at (equal to) the target value,
// make a new target value.
if(_x > Xtarget){
_x = _x - 1;
} else if (_x < Xtarget){
_x = _x + 1;
} else {
Xtarget = random(301); }

}