 |
// the "load" event handler is executed only ONCE,
// when the instance first appears on stage
// it is a good place to declare variables
// and set their initial values
onClipEvent (load) {
var Xincrement = 10;
}
onClipEvent (enterFrame) {
// use the variable to change the property
_x = _x + Xincrement;
// if the instance goes too far
// in either direction,
// change the value of the variable
if(_x > 300){
Xincrement = -10;
}
if (_x < 0){
Xincrement = 10;
}
}
|