# Reversing a code problem

**URL:** <https://forum.kirupa.com/t/reversing-a-code-problem/190324>\
**Category:** Uncategorized\
**Created:** [June 10, 2006, 3:34pm UTC](https://forum.kirupa.com/t/reversing-a-code-problem/190324 "2006-06-10T15:34:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![leruffiant](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/leruffiant/32/2450_2.png) [@leruffiant](https://forum.kirupa.com/u/leruffiant)\
**Post date:** [June 10, 2006, 3:34pm UTC](https://forum.kirupa.com/t/reversing-a-code-problem/190324/1 "2006-06-10T15:34:36Z")

</div>

Hi I’ve got this piece of code that I’m trying to reverse

```auto
 onClipEvent (load) {
    speed = 10;
}
onClipEvent (enterFrame) {
    _y += (_root.target-_y)/speed;
    _x += (_root.target-_x)/speed;
}

Place this MC at x=0, y=0.

Now on a button add the script that contains the position you want to send your MC to:

on (release) {
    _root.target = 250;
}

Thats an example of pretty smooth motion.

```

instead of putting \_root.target = 250; I’ve got target set to 0 on each button, I do:

```auto

newBgValue = mainHolderBackground._x=800;
newBgValue = mainHolderBackground._y=0;
    
_root.target = 0;

```

on each button. However, this is not what I want, I want the clips \*\*to end up \*\*on that position, not start off on my new position!

Hope that someone can help, it’s probably a simple answer eh? 😛

Cheers!

PS: I’m using Flash 8
