Code for stopping mc isn't working [renamed]

I’m using the code :

onClipEvent (load) { targy = 150; targx = 150; }
onClipEvent(enterFrame) { if (this._y == targy and this._x == targx) { gotoAndStop(1); Movex = false; Movey = false; } }

Aligned Version

onClipEvent (load) {
 targy = 150;
 targx = 150;
}
onClipEvent (enterFrame) {
 if (this._y == targy and this._x == targx) {
  gotoAndStop(1);
  Movex = false;
  Movey = false;
 }
}

I have it so that the mc automatically moves to the targx and targy position but for some reason the Movey = false, Movex = false, and gotoAndStop(1); wont work. Please help.