# Zoom and map

**URL:** <https://forum.kirupa.com/t/zoom-and-map/194062>\
**Category:** Uncategorized\
**Created:** [July 20, 2006, 7:29am UTC](https://forum.kirupa.com/t/zoom-and-map/194062 "2006-07-20T07:29:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pavanshinde](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@pavanshinde](https://forum.kirupa.com/u/pavanshinde)\
**Post date:** [July 20, 2006, 7:29am UTC](https://forum.kirupa.com/t/zoom-and-map/194062/1 "2006-07-20T07:29:33Z")

</div>

Hi all

I have a map. i want to add a zoom in/out and feature to it , i am able to zoom in and out .

I am having problem in paning the map. Instance name for the MC is map.

Here is the function that i m using for zooming the map  
function zoom(amount) {  
xoffset = startWidth\*(map.\_x-startx)/(100/amount_map.\_width);  
yoffset = startHeight_(map.\_y-starty)/(100/amount\*map.\_height);  
map.\_xscale = map.\_xscale+amount;  
map.\_yscale = map.\_yscale+amount;  
map.\_x = map.\_x+xoffset;  
map.\_y = map.\_y+yoffset;  
y\_coord = map.\_y;  
x\_coord = map.\_x;  
scale = int(map.\_xscale)+"% view";  
if (map.\_xscale\<=50) {  
map.\_xscale = 50;  
map.\_yscale = 50;  
scale = int(map.\_xscale)+"% view";  
}  
// end if  
}

Thanks
