# Image pan limits

**URL:** https://forum.kirupa.com/t/image-pan-limits/213920
**Category:** Uncategorized
**Created:** [January 24, 2007, 9:11am UTC](https://forum.kirupa.com/t/image-pan-limits/213920 "2007-01-24T09:11:55Z")
**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: [January 24, 2007, 9:11am UTC](https://forum.kirupa.com/t/image-pan-limits/213920/1 "2007-01-24T09:11:55Z")

</div>

hey i have a system of navigation buttons that when rollover they send a one two this script below. I am trying to set limits so that the nav cannot go off the image. anyone have any suggestions on how to write in a limit for the image. i have tried many things but nothing works.

i currently have this:  
if (\_root.map.up2 == 1) {  
\_root.map.\_y = \_root.map.\_y+10;

i feel like i should be able to write something like this:

if (\_root.map.up2 == 1) {  
\_root.map.\_y = \_root.map.\_y+10;  
\_root.map.\_y+10 \< \_root.map.\_y=1000;

here is my code:

onClipEvent (enterFrame) {  
if (\_root.map.up == 1) {  
\_root.map.\_x = \_root.map.\_x+10;  
\_root.map.\_y = \_root.map.\_y+10;  
} if (\_root.map.up2 == 1) {  
\_root.map.\_y = \_root.map.\_y+10;  
} if (\_root.map.up3 == 1) {  
\_root.map.\_x = \_root.map.\_x-10;  
\_root.map.\_y = \_root.map.\_y+10;  
} if (\_root.map.up4 == 1) {  
\_root.map.\_x = \_root.map.\_x-10;  
} if (\_root.map.up5 == 1) {  
\_root.map.\_x = \_root.map.\_x-10;  
\_root.map.\_y = \_root.map.\_y-10;  
} if (\_root.map.up6 == 1) {  
\_root.map.\_y = \_root.map.\_y-10;  
} if (\_root.map.up7 == 1) {  
\_root.map.\_x = \_root.map.\_x+10;  
\_root.map.\_y = \_root.map.\_y-10;  
} if (\_root.map.up8 == 1) {  
\_root.map.\_x = \_root.map.\_x+10;  
}  
}

onClipEvent (load) {  
ease = 5;  
}  
// 1 = move faster…10 = move slower

onClipEvent (enterFrame) {  
if (\_root.target\_x\>1) {  
this.\_x += \_root.target\_x/ease;  
\_root.target\_x -= \_root.target\_x/ease;  
}  
if (\_root.target\_y\>1) {  
this.\_y += \_root.target\_y/ease;  
\_root.target\_y -= \_root.target\_y/ease;  
}  
if (\_root.target\_x\<-1) {  
this.\_x += \_root.target\_x/ease;  
\_root.target\_x -= \_root.target\_x/ease;  
}  
if (\_root.target\_y\<-1) {  
this.\_y += \_root.target\_y/ease;  
\_root.target\_y -= \_root.target\_y/ease;  
}  
}
