# X and y boundary when scrolling

**URL:** <https://forum.kirupa.com/t/x-and-y-boundary-when-scrolling/313102>\
**Category:** Uncategorized\
**Created:** [August 20, 2010, 2:01am UTC](https://forum.kirupa.com/t/x-and-y-boundary-when-scrolling/313102 "2010-08-20T02:01:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rserge](https://avatars.discourse-cdn.com/v4/letter/r/dc4da7/32.png) [@rserge](https://forum.kirupa.com/u/rserge)\
**Post date:** [August 20, 2010, 2:01am UTC](https://forum.kirupa.com/t/x-and-y-boundary-when-scrolling/313102/1 "2010-08-20T02:01:45Z")

</div>

I have a map which I am scrolling up down left and right. Currently the map can be scrolled infinitely. Can somebody share a line of code that sets the x and y limits on the scroll. I need the scroll to stop when it gets to edge of map graphic. I have seen it, just can’t find it. Here is the code for the up scroll.Thanks.

```auto

up_btn.onPress = function() {
	this.onEnterFrame = function() {
		_root.container.map_mc._y += 5;
	};
};
up_btn.onRelease = function() {
	delete this.onEnterFrame;
}
up_btn.onReleaseOutside = function() {
	delete this.onEnterFrame;
}

```
