Setting Maximum X coordinate movement for object

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:


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!