Dynamically limit scroll length

I am trying to limit the length of my scrolling menu to the total width of my menu movie clip, which is dynamically from an xml file. I can get it to scroll just fine, the only problem is that it will keep scrolling even when the movie clip has moved off screen. Any thoughts?

on(press, release, keyPress “<left>”)
thumbnails._x += 30;