# Map pan, setting limits to image

**URL:** <https://forum.kirupa.com/t/map-pan-setting-limits-to-image/208905>\
**Category:** Uncategorized\
**Created:** [December 4, 2006, 4:58am UTC](https://forum.kirupa.com/t/map-pan-setting-limits-to-image/208905 "2006-12-04T04:58:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mileskemp](https://avatars.discourse-cdn.com/v4/letter/m/a587f6/32.png) [@mileskemp](https://forum.kirupa.com/u/mileskemp)\
**Post date:** [December 4, 2006, 4:58am UTC](https://forum.kirupa.com/t/map-pan-setting-limits-to-image/208905/1 "2006-12-04T04:58:35Z")

</div>

hey I have a large map in an mc and navigation buttons to control the map.

2 questions:

1.Does anyone know how to set limits on this? my image is w2200 h2980? stage is 1000w x 740h I am using code like this? Th buttons are either 1 or a 0 so i think the limit function needs to be in this section.

1. does anyone know how to adjust the script for zoom so that the image will zoom in n out without refocusing on a specific point. my large map move to a specific location as it zooms. it would be cooler if the the map zoomed in and out based on current location.

Thanks again. I have been trying but no luck.  
demo version is here: [http://www.tmtrestoration.com/demo/main/main.htm](http://www.tmtrestoration.com/demo/main/main.htm)

onClipEvent (enterFrame) {  
if (\_root.map.\_width \> “2200”) {  
\_root.map.larger = 0;  
} if (\_root.map.\_width \< “726”) {  
\_root.map.smaller = 0;  
} if (\_root.map.up == 1) {  
\_root.map.\_x = \_root.map.\_x+5;  
\_root.map.\_y = \_root.map.\_y+5;  
} if (\_root.map.up2 == 1) {  
\_root.map.\_y = \_root.map.\_y+5;  
} if (\_root.map.up3 == 1) {  
\_root.map.\_x = \_root.map.\_x-5;  
\_root.map.\_y = \_root.map.\_y+5;  
} if (\_root.map.up4 == 1) {  
\_root.map.\_x = \_root.map.\_x-5;  
} if (\_root.map.up5 == 1) {  
\_root.map.\_x = \_root.map.\_x-5;  
\_root.map.\_y = \_root.map.\_y-5;  
} if (\_root.map.up6 == 1) {  
\_root.map.\_y = \_root.map.\_y-5;  
} if (\_root.map.up7 == 1) {  
\_root.map.\_x = \_root.map.\_x+5;  
\_root.map.\_y = \_root.map.\_y-5;  
} if (\_root.map.up8 == 1) {  
\_root.map.\_x = \_root.map.\_x+5;  
} if (\_root.map.larger == 1) {  
\_root.map.\_xscale = \_root.map.\_xscale+2;  
\_root.map.\_yscale = \_root.map.\_yscale+2;  
\_root.target\_x = (Stage.height/2)-(this.\_x+\_root.map.\_x);  
\_root.target\_y = (Stage.height/2)-(this.\_y+\_root.map.\_y);  
} if (\_root.map.smaller == 1) {  
\_root.map.\_xscale = \_root.map.\_xscale-2;  
\_root.map.\_yscale = \_root.map.\_yscale-2;  
\_root.target\_x = (Stage.height/2)-(this.\_x+\_root.map.\_x);  
\_root.target\_y = (Stage.height/2)-(this.\_y+\_root.map.\_y);  
}  
}
