# Zoom to Mouse X & Y

**URL:** <https://forum.kirupa.com/t/zoom-to-mouse-x-y/167713>\
**Category:** flash\
**Created:** [October 31, 2005, 8:54am UTC](https://forum.kirupa.com/t/zoom-to-mouse-x-y/167713 "2005-10-31T08:54:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![onemhunki](https://avatars.discourse-cdn.com/v4/letter/o/c57346/32.png) [@onemhunki](https://forum.kirupa.com/u/onemhunki)\
**Post date:** [October 31, 2005, 8:54am UTC](https://forum.kirupa.com/t/zoom-to-mouse-x-y/167713/1 "2005-10-31T08:54:48Z")

</div>

Folks,

Got a question regarding a zoomable map I’m building. I’ve got the zoom function sorted, but I’d like to build something that zooms in on the current mouse position, rather than setting the map’s x & y to that of the mouse, that’s not quite right, attached is the code I’m using, anyone any ideas how I acheive this?

```auto

onMouseDown = function() {
	curMouseX = _root._xmouse;
	curMouseY = _root._ymouse;
	map._xscale += 10;
	map._yscale += 10;
	map._x = curMouseX;
	map._y = curMouseY;
}

```

Cheers
