I have my movie clip walk off the left side of stage and come back on the right of the stage. but I cant get it to walk off the right and come back on the left can any one give advise please. this is what I have so far
onClipEvent(load) {
var direction = “left”;
var speed = 10 ;
}
onClipEvent(enterFrame) {
if(Key.isDown(Key.LEFT)){
this.direction = “left”;
this._x -= speed;
this.gotoAndPlay(‘walkleft’);
if(this._x<0-this._width)this._x=Stage.width;
} else if(Key.isDown(Key.RIGHT)) {
this.direction = “right”;
this._x += speed;
this.gotoAndPlay(‘walkright’);
//if(this._x<0+this._width)this._x=Stage.width;
} else {
this.gotoAndPlay('wait'+this.direction);
}
trace(this._x);
}