Auto move

ok ive been working on this code for …all day now…and for some reason i cannot get it to work. what im attempting to do is have this charactor move back and forth slowly (almost like a motion tween…through action script) maybe one of you could help me.

onClipEvent (enterFrame) {
if (dir == “right”){
this._x += 3; {
if(this._x>509) {
dir=“left”;}}
}
if (dir==“left”){
this._x -= 3;{
if (this._x<50) {
dir = “right”;
}}}

}

just attach this to ur MC


 onClipEvent (load) {
 	Speed = 3;
 }
 onClipEvent (enterFrame) {
 	if (_x+Speed>500 || _x+Speed<0) {
 		Speed *= -1;
 	}
 	_x += Speed;
 }
 
 

that worked awesome man…thanks…i dont quite understand it but thanks lol

PS. How do you get that little code box…the quote box??

In advanced reply there are CODE tags.