# If(x=0 and y=0) { ... i dont get it

**URL:** <https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227>\
**Category:** Uncategorized\
**Created:** [August 3, 2004, 8:12pm UTC](https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227 "2004-08-03T20:12:55Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [August 3, 2004, 8:12pm UTC](https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227/1 "2004-08-03T20:12:55Z")

</div>

hi if got this code:

```auto

function go(to){
   movies.onEnterFrame = function(){
   speed = 10;
   x = 400 - this._x;
   this._x += x/speed;
   y = 200 - this._y;
   this._y += y/speed;
   trace(y);
   if(x=0 and y=0) {
	  daarna(to);
	  delete this.onEnterFrame;
	 }
   }
}

```

but when i test this frame i get this error:

```auto
  **Error** Scene=Scene 1, layer=Layer 6, frame=1:Line 9: Left side of assignment operator must be variable or property.
	   if(x=0 and y=0) {

```

i dont get it … because x is an variable… i also tried some other variable name but this doesnt work either…

btw i use FMX04

---

<div class="post-metadata">

**Author:** ![Adam1](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Adam1](https://forum.kirupa.com/u/Adam1)\
**Post date:** [August 3, 2004, 8:14pm UTC](https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227/2 "2004-08-03T20:14:59Z")

</div>

try:

if(x==0 && y==0) {

you need two equal signs to test for equality.

Adam

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [August 3, 2004, 8:29pm UTC](https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227/3 "2004-08-03T20:29:41Z")

</div>

i still got a problem… ive adjusted my code:

```auto

function go(to){
	movies.onEnterFrame = function(){
		speed = 10;
		x = 400 - this._x;
		this._x += x/speed;
		y = 200 - this._y;
		this._y += y/speed;
		if(y<1 && y>-.5){
			neary = 0;
		}
		if(x<.5 && x>-.5){
			nearx = 0;
		}
		if(neary==0 && nearx==0) {
			trace("test");
				daarna(to);
				delete this.onEnterFrame;
			}
		
	}
}

```

but now it just deletes the this.onEnterFrame…

---

<div class="post-metadata">

**Author:** ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)\
**Post date:** [August 3, 2004, 9:19pm UTC](https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227/4 "2004-08-03T21:19:35Z")

</div>

> [@2nd day](#):
>
> i still got a problem… ive adjusted my code:
> 
> ```auto
> 
> function go(to){
> movies.onEnterFrame = function(){
> speed = 10;
> x = 400 - this._x;
> this._x += x/speed;
> y = 200 - this._y;
> this._y += y/speed;
> if(y<1 && y>-.5){
> neary = 0;
> }
> if(x<.5 && x>-.5){
> nearx = 0;
> }
> if(neary==0 && nearx==0) {
> trace("test");
> daarna(to);
> delete this.onEnterFrame;
> }
> 		
> }
> }
> 
> ```
> 
> but now it just deletes the this.onEnterFrame…

it works in mx.  
How are you calling the function?  
Have you a movie with instance name movies?

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [August 3, 2004, 9:27pm UTC](https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227/5 "2004-08-03T21:27:46Z")

</div>

i’ve got a button (a real btn not a mc) in a menu mc… when you release the button it calls the function (on(release){ \_root.go(); })

---

<div class="post-metadata">

**Author:** ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)\
**Post date:** [August 3, 2004, 9:34pm UTC](https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227/6 "2004-08-03T21:34:23Z")

</div>

> [@2nd day](#):
>
> i’ve got a button (a real btn not a mc) in a menu mc… when you release the button it calls the function (on(release){ \_root.go(); })

so the function is on the main timeline and have you a mc with instance name movies on \_root

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [August 3, 2004, 10:10pm UTC](https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227/7 "2004-08-03T22:10:03Z")

</div>

that’s right…

---

<div class="post-metadata">

**Author:** ![stringy](https://avatars.discourse-cdn.com/v4/letter/s/919ad9/32.png) [@stringy](https://forum.kirupa.com/u/stringy)\
**Post date:** [August 3, 2004, 10:18pm UTC](https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227/8 "2004-08-03T22:18:30Z")

</div>

> [@2nd day](#):
>
> that’s right…

well it works for me with mx(not 2004)

---

<div class="post-metadata">

**Author:** ![2nd\_day](https://avatars.discourse-cdn.com/v4/letter/2/a4c791/32.png) [@2nd\_day](https://forum.kirupa.com/u/2nd_day)\
**Post date:** [August 3, 2004, 10:43pm UTC](https://forum.kirupa.com/t/if-x-0-and-y-0-i-dont-get-it/118227/9 "2004-08-03T22:43:09Z")

</div>

thanks for help… but the problem was something else and i already fixed it…  
[http://thomas.zeal-music.com/flash/test.html](http://thomas.zeal-music.com/flash/test.html) here is what i’ve made…
