# Mc movement using AS

**URL:** <https://forum.kirupa.com/t/mc-movement-using-as/161508>\
**Category:** Uncategorized\
**Created:** [September 4, 2005, 6:36pm UTC](https://forum.kirupa.com/t/mc-movement-using-as/161508 "2005-09-04T18:36:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ants](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Ants](https://forum.kirupa.com/u/Ants)\
**Post date:** [September 4, 2005, 6:36pm UTC](https://forum.kirupa.com/t/mc-movement-using-as/161508/1 "2005-09-04T18:36:36Z")

</div>

Hey guys I’m trying to move a dynamically generated mc to an x,y location but it seems they are very erratic.

The dynamically generated mc is using the [kirupa random movement](http://www.kirupa.com/developer/actionscript/random_motion.htm)

When a user mouses over the button **resume** it sets **\_root.mouseStatusResume** to \*\*“on” \*\*then it makes the dynamically generated mc \*\*dot27 \*\*to tween into position. But as you can see from the x,y coordinates below, its not working properly, and shows up in all diff areas.

I did a trace on the x.y coordinates and here they are:

> x = 440.6y = 139.8  
> x = 432.6y = 139.8  
> x = 440.6y = 139.8  
> x = 432.8y = 139.8

Seems that it depends on where the mc is which yields the funky x values.

Here’s my code:

```auto
onClipEvent (enterFrame) {
	if (_root.mouseStatusResume == "on"){
		//x movement
		//(constant+x)
		this._parent.dot27._x += ((198+this.resume._x) - this._parent.dot27._x)/5.0;
		//y movement
		//(constant+y)
		this._parent.dot27._y += ((117+27) - this._parent.dot27._y)/5.0;
		var message = "x = " + this._parent.dot27._x + "y = " + this._parent.dot27._y;
		trace(message);
	}
}

```

Thanks to everyone that responds!
