Syntax help

I’m trying to write the Actionscript code that will move my MC to a certain point then reset. In other words, I want my MC to move left until it reaches -650 of the X position then start all over again fro 750 of the X position.\r\rHere’s the code I’ve written which doesn’t work:\r\ronClipEvent (enterFrame) {\r _x-=2;\r&nbsp &nbsp &nbsp &nbsp }\rif (_x =-670\r _X = 740\r\rAny aid would be appreciated immensely.

onClipEvent (enterFrame) {\r _x -= 2;\r if (_x = -670) {\r _x = 740\r }\r}

wrong! be carefull to use double equals when checking, else you set the variable!\rNot: if (_x = -670) but if (_x == -670)!\rAnd this check is dangerous, coz if your clip is not positioned on a full pixel (say _x=749.3) at the start, it will NEVER be equal to -670, you need to check for <= (less than or equal to) to make sure!

doh! I know…i missed that…I just copied and pasted and I didn’t realize…shame on me…:frowning:

This is the code that isn’t working:\r\ronClipEvent (enterFrame) {\r&nbsp &nbsp &nbsp &nbsp _x -= 5;\r&nbsp &nbsp &nbsp &nbsp if (_x <== -670) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _x = 0;\r&nbsp &nbsp &nbsp &nbsp }\r}\r\rHere’s the error message verbatim: “Scene=Scene 1, Layer=topheader, Frame=1: Line 3: Operator ‘<=’ must be followed by an operand\r &nbsp &nbsp &nbsp &nbsp if (_x <== -670) {”\r\rAny further aid will be appreciated Eyezberg and/or I am not Jubba…\r

onClipEvent (enterFrame) {\r _x -= 5;\r if (_x <= -670) {\r _x = 0;\r }\r}

Thanks upuaut8.\r\rThat’s strange. Ic had previously tried the code you provided, but it didn’t work then. Now however it works.\r\rI also came with a code to do the same action:\r\ronClipEvent (load) {\r&nbsp &nbsp &nbsp &nbsp speed -= 2;\r&nbsp &nbsp &nbsp &nbsp left = -300;\r&nbsp &nbsp &nbsp &nbsp right = 370;\r}\ronClipEvent (enterFrame) {\r&nbsp &nbsp &nbsp &nbsp _x -= 2;\r&nbsp &nbsp &nbsp &nbsp if (_x<=left) {\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _x = right;\r&nbsp &nbsp &nbsp &nbsp }\r}\r\rThanks buddy…