# Moving the the object to x point

**URL:** <https://forum.kirupa.com/t/moving-the-the-object-to-x-point/282241>\
**Category:** Uncategorized\
**Created:** [February 19, 2009, 9:12am UTC](https://forum.kirupa.com/t/moving-the-the-object-to-x-point/282241 "2009-02-19T09:12:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![smallDot](https://avatars.discourse-cdn.com/v4/letter/s/a8b319/32.png) [@smallDot](https://forum.kirupa.com/u/smallDot)\
**Post date:** [February 19, 2009, 9:12am UTC](https://forum.kirupa.com/t/moving-the-the-object-to-x-point/282241/1 "2009-02-19T09:12:45Z")

</div>

i tried to modify this code, so when i click the circle, it moves to x position which the there is a transparent circle named cir  
the sp moves but do not stop at the cir x

any help

```
ActionScript Code:
[LEFT][COLOR=#000000] **var** [/COLOR] sp:Sprite = [COLOR=#000000] **new** [/COLOR] Sprite[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];

```

sp.[COLOR=#000080]graphics[/COLOR].[COLOR=#0000FF]beginFill[/COLOR]COLOR=#000000[/COLOR];  
sp.[COLOR=#000080]graphics[/COLOR].[COLOR=#000080]drawCircle[/COLOR]COLOR=#000000[/COLOR];  
sp.[COLOR=#000080]graphics[/COLOR].[COLOR=#0000FF]endFill[/COLOR]COLOR=#000000[/COLOR];  
addChildCOLOR=#000000[/COLOR];

sp.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]MouseEvent.[COLOR=#000080]CLICK[/COLOR], fade[COLOR=#000000])[/COLOR];

[COLOR=#000000] **function** [/COLOR] fadeCOLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR] [COLOR=#000000]{[/COLOR]  
sp.[COLOR=#000080]addEventListener[/COLOR][COLOR=#000000]([/COLOR]Event.[COLOR=#000080]ENTER\_FRAME[/COLOR], enterF[COLOR=#000000])[/COLOR];  
[COLOR=#000000]}[/COLOR]

[COLOR=#000000] **function** [/COLOR] enterFCOLOR=#000000[/COLOR]:[COLOR=#0000FF]void[/COLOR] [COLOR=#000000]{[/COLOR]  
sp.[COLOR=#000080]x[/COLOR] += [COLOR=#000080]4[/COLOR][COLOR=#000080][/COLOR];  
[COLOR=#0000FF]if[/COLOR] [COLOR=#000000]([/COLOR]sp.[COLOR=#000080]x[/COLOR] == cir.[COLOR=#000080]x[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
sp.[COLOR=#000080]removeEventListener[/COLOR][COLOR=#000000]([/COLOR]Event.[COLOR=#000080]ENTER\_FRAME[/COLOR], enterF[COLOR=#000000])[/COLOR];  
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR];  
[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]  
[/LEFT]
