# Setting Maximum X coordinate movement for object

**URL:** <https://forum.kirupa.com/t/setting-maximum-x-coordinate-movement-for-object/281179>\
**Category:** flash\
**Created:** [February 5, 2009, 7:57pm UTC](https://forum.kirupa.com/t/setting-maximum-x-coordinate-movement-for-object/281179 "2009-02-05T19:57:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iiswansongii](https://avatars.discourse-cdn.com/v4/letter/i/e480ec/32.png) [@iiswansongii](https://forum.kirupa.com/u/iiswansongii)\
**Post date:** [February 5, 2009, 7:57pm UTC](https://forum.kirupa.com/t/setting-maximum-x-coordinate-movement-for-object/281179/1 "2009-02-05T19:57:26Z")

</div>

I have a menu, that moves left and right using a move left and move right button that makes more of the menu come into view in the left and right direction.

I want the object to stop moving when it’s at the beginning and stop moving at the end.

I thought I could set a ‘max x coordinate’ so that if previous was hit the object would not move anymore to the left but it still does.

Here is the code I tried to use that doestn’ work:

```auto

My Previous Button:
 
on(press) {
 currentX = _root.years._x;
 _root.years._x = currentX + 400;
 _root.years.Math.max(590.80);
}
 
 
 
 
My Forward Button:
on(press) {
 currentX = _root.years._x;
 _root.years._x = currentX - 400;
 _root.years.Math.min(-6240);
} 

```

If there is any help you can give me with this ASAP that would be great!

Seems like such a simple thing but I 've been unable to find any help with at all.

Thanks in advance!
