# \[as\]moving clips

**URL:** https://forum.kirupa.com/t/as-moving-clips/83510
**Category:** flash
**Created:** [March 19, 2005, 5:20pm UTC](https://forum.kirupa.com/t/as-moving-clips/83510 "2005-03-19T17:20:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![cki](https://avatars.discourse-cdn.com/v4/letter/c/85f322/32.png) [@cki](https://forum.kirupa.com/u/cki)
#### Post date: [March 19, 2005, 5:20pm UTC](https://forum.kirupa.com/t/as-moving-clips/83510/1 "2005-03-19T17:20:09Z")

</div>

After creating a container with 5 dynamically attached clips. I want to place the move the clips to coordinate from xArray and yArray the clips are not moving. What did I goof?

```auto

//VARIABLE TO STORE NUMBER OF CLIPS DESIRED
clipCount = 5;
xArray(25, 50, 75, 100, 125);
yArray(200, 250, 300, 350, 400);
newX = xArray[i-1];
// set coordinate X (destination)
newY = yArray[i-1];
// set coordinate Y (destination)
inertia = random(25)+8;
_root.createEmptyMovieClip("container_mc", 0);
function addClips() {
	for (var i = 0; i<=clipCount; i++) {
		container_mc.attachMovie("testClip", "theClip"+i, i);
		container_mc["theClip"+i].onEnterFrame = function() {
		move(this);
		};
		//trace("loaded");
	}
}
addClips();
//FUNCTION TO MOVE THE CLIPS
function move(target) {
	// calculate distance
	target.distX = (target.newX-target._x);
	// CHANGED
	target.distY = (target.newY-target._y);
	// CHANGED
	// move
	target._x += target.distX/target.inertia;
	// CHANGED
	target._y += target.distY/target.inertia;
	// CHANGED
}

```
