# Show the X and Y postions of a dragable object?

**URL:** <https://forum.kirupa.com/t/show-the-x-and-y-postions-of-a-dragable-object/64031>\
**Category:** flash\
**Created:** [September 12, 2004, 5:27pm UTC](https://forum.kirupa.com/t/show-the-x-and-y-postions-of-a-dragable-object/64031 "2004-09-12T17:27:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arekaine](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@Arekaine](https://forum.kirupa.com/u/Arekaine)\
**Post date:** [September 12, 2004, 5:27pm UTC](https://forum.kirupa.com/t/show-the-x-and-y-postions-of-a-dragable-object/64031/1 "2004-09-12T17:27:42Z")

</div>

So I have a dragable object on the screen. I also have a couple of text boxes that are supposed to show it’s X and Y postions.

Now I can get it to show the postion it started in,using the getProperty. But when I move it the numbes won’t update. So I tried to do it the same way you would if you wanted the to get the postions of the mouse. That didn’t work either. Any body know how to solve this little problem? Thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 12, 2004, 5:38pm UTC](https://forum.kirupa.com/t/show-the-x-and-y-postions-of-a-dragable-object/64031/2 "2004-09-12T17:38:20Z")

</div>

Is the AS running through that every frame?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 2:10am UTC](https://forum.kirupa.com/t/show-the-x-and-y-postions-of-a-dragable-object/64031/3 "2004-09-13T02:10:27Z")

</div>

Or you haven’t put “\_root.” before each reference to the objects in your code.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 9:30am UTC](https://forum.kirupa.com/t/show-the-x-and-y-postions-of-a-dragable-object/64031/4 "2004-09-13T09:30:53Z")

</div>

lets think your draggable MC is “MC1” which is on the root.  
textBox which contain the position is text1.

here is the function:

\_root.MC1.onEnterFrame = function(){  
xValue = this.\_x;  
yValue = this.\_y;  
\_root.text1.text = xValue+", "yValue;  
}

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 13, 2004, 9:32am UTC](https://forum.kirupa.com/t/show-the-x-and-y-postions-of-a-dragable-object/64031/5 "2004-09-13T09:32:19Z")

</div>

sorry (Ammendment) :  
\_root.MC1.onEnterFrame = function(){  
xValue = this.\_x;  
yValue = this.\_y;  
\_root.text1.text = xValue+", "+yValue;  
}
