onClipEvent (load) {
var Xdirection = 1;
}
onClipEvent (enterFrame) {
// the variable changes the direction
_x = _x + 10*Xdirection;
// if the instance goes too far
// in either direction,
// change the SIGN of the variable
if(_x > 300){
Xdirection = -1;
}
if (_x < 0){
Xdirection = 1;
}
}
|