# \[AS2\] X,Y Coordinates Perfect Position

**URL:** <https://forum.kirupa.com/t/as2-x-y-coordinates-perfect-position/332559>\
**Category:** flash\
**Created:** [July 23, 2014, 11:57am UTC](https://forum.kirupa.com/t/as2-x-y-coordinates-perfect-position/332559 "2014-07-23T11:57:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![theicecube92](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@theicecube92](https://forum.kirupa.com/u/theicecube92)\
**Post date:** [July 23, 2014, 11:57am UTC](https://forum.kirupa.com/t/as2-x-y-coordinates-perfect-position/332559/1 "2014-07-23T11:57:12Z")

</div>

Hey guys,  
I have a little problem with the x,y coords.  
So the thing is that I have 2 movieclips and I want one of them to be the exact position as the other one. (_object2_ = same x,y coords as _object1_)

I have a simple code, but it’s not perfect because _object2_ kinda bounces off.

[AS]  
onEnterFrame = function () {  
object2.\_x = object1.\_x;  
object2.\_y = object1.\_y;

```
if (Key.isDown(Key.UP)) {
    object1._y -= 5;
}
if (Key.isDown(Key.DOWN)) {
    object1._y += 5;
}
if (Key.isDown(Key.RIGHT)) {
    object1._x += 5;
}
if (Key.isDown(Key.LEFT)) {
    object1._x -= 5;
}

```

};  
[/AS]

\*\*(red + = object2)  
\*\*  
Here’s the SWF:  
[http://megaswf.com/s/2676462](http://megaswf.com/s/2676462)

Any help is greatly appreciated! 🙂

Thanks!  
(Sorry for my bad English)
