# Move movieclip to certain coordinates

**URL:** https://forum.kirupa.com/t/move-movieclip-to-certain-coordinates/38900
**Category:** flash
**Created:** [December 31, 2003, 10:44am UTC](https://forum.kirupa.com/t/move-movieclip-to-certain-coordinates/38900 "2003-12-31T10:44:04Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![nick\_g](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@nick\_g](https://forum.kirupa.com/u/nick_g)
#### Post date: [December 31, 2003, 10:44am UTC](https://forum.kirupa.com/t/move-movieclip-to-certain-coordinates/38900/1 "2003-12-31T10:44:04Z")

</div>

Hey,

I have a movieclip that has a horizontal line in it… Also in this flash movie (not in that movieclip) I have an array of links that will change the value of a variable to a different y coordinate (something like ‘50’ or ‘73’) when clicked.

I would like for the movieclip with the horizontal line to move, using actionscript, to the y coordinate specified by that variable. I need it to move from its current location to that location, so no matter where it is on the site, it will move vertically to the coordinate specified by the variable.

Any help would be great (-: .

-Nick :disco:

---

<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: [December 31, 2003, 11:19am UTC](https://forum.kirupa.com/t/move-movieclip-to-certain-coordinates/38900/2 "2003-12-31T11:19:35Z")

</div>

change the line to a simblo the just ad this action

if(z=73){  
telltarget.\_y.  
}

sould ask in actionskript forum. i am not a real wizzard in actionskript.

---

<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: [December 31, 2003, 1:48pm UTC](https://forum.kirupa.com/t/move-movieclip-to-certain-coordinates/38900/3 "2003-12-31T13:48:35Z")

</div>

This question has been asked before. Do a search on the forums, with keywors such as easing, scripted motion…

T-O \> That code is not going to work.

---

<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: [December 31, 2003, 2:15pm UTC](https://forum.kirupa.com/t/move-movieclip-to-certain-coordinates/38900/4 "2003-12-31T14:15:57Z")

</div>

> \*Originally posted by Ilyas da Pom \*  
> \*\*T-O \> That code is not going to work. \*\*

LOL I know :hr:

---

<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: [December 31, 2003, 11:16pm UTC](https://forum.kirupa.com/t/move-movieclip-to-certain-coordinates/38900/5 "2003-12-31T23:16:55Z")

</div>

I just tried searching, but couldn’t find what I’m looking for …

Maybe you guys could point me to a thread discussing this same topic, or maybe a tutorial or something?

-Nick

---

<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: [January 1, 2004, 12:24am UTC](https://forum.kirupa.com/t/move-movieclip-to-certain-coordinates/38900/6 "2004-01-01T00:24:51Z")

</div>

```auto

MovieClip.prototype.moveY = function(newY, speed) {
	pos = (newY > this._x);
	speed = Math.abs(speed);
	moveMe = (speed >= Math.abs(this._y - newY)) ? this._y = newY : undefined;
	if (moveMe == undefined) {
		this.onEnterFrame = function() {
			trace(this._y);
			if (pos) {
				(this._y < newY) ? this._y += speed : delete this.onEnterFrame;
			} else {
				(this._y > newY) ? this._y -= speed : delete this.onEnterFrame;
			}
		};
	}
};

```

btw. here’s the link [http://www.kirupaforum.com/forums/showthread.php?s=&postid=391649#post391649](http://www.kirupaforum.com/forums/showthread.php?s=&postid=391649#post391649)  
😛
