# Trying to replace mc on their original position!

**URL:** <https://forum.kirupa.com/t/trying-to-replace-mc-on-their-original-position/273630>\
**Category:** flash\
**Created:** [October 17, 2008, 8:30pm UTC](https://forum.kirupa.com/t/trying-to-replace-mc-on-their-original-position/273630 "2008-10-17T20:30:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![carldufourm](https://avatars.discourse-cdn.com/v4/letter/c/e5b9ba/32.png) [@carldufourm](https://forum.kirupa.com/u/carldufourm)\
**Post date:** [October 17, 2008, 8:30pm UTC](https://forum.kirupa.com/t/trying-to-replace-mc-on-their-original-position/273630/1 "2008-10-17T20:30:32Z")

</div>

OK here it is:

im doing a drag and drop quiz in as2, and so far it all works, except the Reset function which is suposed to replace all of the numbers on their original position. Here is the function that at the begining of the frame stores in two arrays the original positions of all the numbers:

```auto
function posInitiale() {
for (j=0; j<=target1.length; j++){
	arrayPosX.push(_root[target2[j]]._x);
	arrayPosY.push(_root[target2[j]]._y);
	}
}

```

It works, when I do a trace of the them, I get something like this:

569.95,570,570,570,570 \<-- X  
232.65,280.7,328.7,376.7,424.7 \<-- Y

When I press the Reset button, it executes the function that is suposed to reponsition them on their original position. Here is the function:

```auto
function replacer() {
	for (g=0; g<=target1.length; g++){
		_root[target2[g]]._x = Number(_root.arrayPosX[g]);
		_root[target2[g]]._y = Number(_root.arrayPosX[g]);
	}
}

```

This, doesnt work, it replaces all of the outside of the scene of flash, if you open the swf bigger you will see them at the bottom of the screen, and they are all on top of each other. But again, if in this function I trace both the arrays I still get the same result, which are the correct position they should go on. I have no clue why it does this…

I have attached my files.

Thank you in advance for the help!

Carl
