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

onClipEvent (load) {
var Xtarget = random(301);
}
onClipEvent (enterFrame) {
// i can also separate the motion
// and the resetting of the variable
if(_x > Xtarget){
_x = _x - 10;
} else {
_x = _x + 10;
}
// if the instance is within 15 pixels
// of the target value, set a new target
if(Math.abs(_x - Xtarget) < 15){
Xtarget = random(301);

}
// Math.abs(somenumber), a method of the
// Math Object, returns // the absolute value of "somenumber"
}