# More moving problems

**URL:** <https://forum.kirupa.com/t/more-moving-problems/158811>\
**Category:** Uncategorized\
**Created:** [August 12, 2005, 1:35am UTC](https://forum.kirupa.com/t/more-moving-problems/158811 "2005-08-12T01:35:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vexir](https://avatars.discourse-cdn.com/v4/letter/v/a183cd/32.png) [@Vexir](https://forum.kirupa.com/u/Vexir)\
**Post date:** [August 12, 2005, 1:35am UTC](https://forum.kirupa.com/t/more-moving-problems/158811/1 "2005-08-12T01:35:09Z")

</div>

Hey guys, back with more moving using AS problems. 😟

All I want to do is for a MC to move to a certain x when I click on it. Thats IT. But flash has all these restrictions on clip events and on handlers and stuff; it makes it really hard. So I have this code on the main timeline:

```auto
MovieClip.prototype.xmove = function(targetx, side, speed) {
	this.onEnterFrame = function() {
		if (side = "left") {
			while (this._x > targetx) {
				this._x = this._x - speed;
			}
		}
		else if (side = "right") {
			while (this._x < targetx) {
				this._x = this._x + speed;
			}
		}
	};
};

```

and this on the MC I want to move:

```auto

on(release){
        this.xmove(0, left, 1);
}

```

I just don’t see why this won’t work! All it does is teleport to the targetx! It doesn’t actually MOVE. I thought this would be simple. 😟 Help!
