# Zoom to clicked position

**URL:** <https://forum.kirupa.com/t/zoom-to-clicked-position/234579>\
**Category:** Uncategorized\
**Created:** [August 3, 2007, 2:35pm UTC](https://forum.kirupa.com/t/zoom-to-clicked-position/234579 "2007-08-03T14:35:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![halian](https://avatars.discourse-cdn.com/v4/letter/h/45deac/32.png) [@halian](https://forum.kirupa.com/u/halian)\
**Post date:** [August 3, 2007, 2:35pm UTC](https://forum.kirupa.com/t/zoom-to-clicked-position/234579/1 "2007-08-03T14:35:47Z")

</div>

So I’ve been working on a being able to click on an image and zoom it to that position.

my movie is 550x340. just make a mc with an image and give it the linkage ID of “box\_mc”. I put a crosshair in that MC as well so i can see where it zooms to.

The problem I’m having is that on the third click, it won’t adjust correctly. I don’t understand why not. Maybe you people can aid a little.

```auto

_root.attachMovie("box_mc","box_mc",this.getNextHighestDepth());
MovieClip.prototype.scaler = function(nValue) {
    nValue *= this._height;
    if (this._height<nValue) {
        ratio = this._height/nValue;
        this._xscale = this._yscale /= ratio;
    } else {
        ratio = nValue/this._height;
        this._xscale = this._yscale *= ratio;
    }
};
var mX = 0;
var mY = 0;
box_mc.onPress = function(){
    mX += _xmouse;
    mY += _ymouse;
    this.scaler(2);
    this._x -= mX;
    this._y -= mY;
}

```
