# Syntax help

**URL:** <https://forum.kirupa.com/t/syntax-help/2752>\
**Category:** Uncategorized\
**Created:** [April 20, 2002, 2:00am UTC](https://forum.kirupa.com/t/syntax-help/2752 "2002-04-20T02:00:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 20, 2002, 2:00am UTC](https://forum.kirupa.com/t/syntax-help/2752/1 "2002-04-20T02:00:09Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 20, 2002, 3:05am UTC](https://forum.kirupa.com/t/syntax-help/2752/2 "2002-04-20T03:05:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 20, 2002, 5:14am UTC](https://forum.kirupa.com/t/syntax-help/2752/3 "2002-04-20T05:14:07Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 20, 2002, 11:46am UTC](https://forum.kirupa.com/t/syntax-help/2752/4 "2002-04-20T11:46:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 20, 2002, 6:41pm UTC](https://forum.kirupa.com/t/syntax-help/2752/5 "2002-04-20T18:41:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 20, 2002, 7:09pm UTC](https://forum.kirupa.com/t/syntax-help/2752/6 "2002-04-20T19:09:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 20, 2002, 7:47pm UTC](https://forum.kirupa.com/t/syntax-help/2752/7 "2002-04-20T19:47:25Z")

</div>

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…
