# Moving box back to xpos when reaches certain x coord

**URL:** <https://forum.kirupa.com/t/moving-box-back-to-xpos-when-reaches-certain-x-coord/205820>\
**Category:** Uncategorized\
**Created:** [November 2, 2006, 8:43am UTC](https://forum.kirupa.com/t/moving-box-back-to-xpos-when-reaches-certain-x-coord/205820 "2006-11-02T08:43:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrmark](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mrmark/32/2968_2.png) [@mrmark](https://forum.kirupa.com/u/mrmark)\
**Post date:** [November 2, 2006, 8:43am UTC](https://forum.kirupa.com/t/moving-box-back-to-xpos-when-reaches-certain-x-coord/205820/1 "2006-11-02T08:43:32Z")

</div>

heya,

i just read your tutorial about making an object move from one side to another by using actionscript. so now i was wondering how to make the box get back into the same place as it started when it reaches a certain point.

can someone please help me with adding the code to this AS i already got:

```auto
onClipEvent(enterFrame) {
    speed = 5;
    this._x += speed;
}

```

thank you very much
