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

hi if got this code:


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:

  **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

try:

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

you need two equal signs to test for equality.

Adam

i still got a problem… ive adjusted my code:


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?

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

that’s right…

well it works for me with mx(not 2004)

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