# Reversing this zooming correction code

**URL:** <https://forum.kirupa.com/t/reversing-this-zooming-correction-code/184991>\
**Category:** flash\
**Created:** [April 10, 2006, 3:03am UTC](https://forum.kirupa.com/t/reversing-this-zooming-correction-code/184991 "2006-04-10T03:03:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 10, 2006, 3:03am UTC](https://forum.kirupa.com/t/reversing-this-zooming-correction-code/184991/1 "2006-04-10T03:03:49Z")

</div>

Im using scaling in an onEnterFrame to achieve a zoom in and out for an image thats being used in a 360 VR arrangement. (using its \_x property to spin it left or right)

Seeing as the registration point of the movie clip with the image in it is in the centre of it, when it zooms in and out i need to correct the x position to compensate from the growing from the centrepoint so the image doesnt whizz past the viewing, window but instead stays focused on what you were looking at when you clicked zoom in.

on the zoom button in an on(release) set a var that points to where the x of the scaled up image should be once its finished in order to look like it hasnt moved. targetsize variable is something like 200 (the scale i want to zoom in), and halfOfStageWidth is exactly that.

```auto

on (release) {
        Xforzooming = (this.image_mc._x*(this.targetsize/100))-(halfOfStageWidth);
    }
}

```

then in the onEnterFrame that does the scaling i also use

```auto

this.image_mc._x += (this.Xforzooming-this.image_mc._x)/this.zoomacc;

```

zoomacc is something like 20, its used to ease the movement.

ok so this works fine - but how do i \*\*reverse \*\*this for zooming out. what should i set Xforzooming to when i click the zoom out button.

And what AS should i use to ease the \_x in the oppisite direction? So that if i was to click zoom in and zoom out over and over it would appear as if nothings moved?

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 10, 2006, 6:49am UTC](https://forum.kirupa.com/t/reversing-this-zooming-correction-code/184991/2 "2006-04-10T06:49:53Z")

</div>

any people who are good at maths stuff this would be piss easy come on - like you peoples who are workin on that awesome 2d text array, this would be easy for you 😉

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 11, 2006, 3:21am UTC](https://forum.kirupa.com/t/reversing-this-zooming-correction-code/184991/3 "2006-04-11T03:21:39Z")

</div>

_bump_ come on peoples 😛

---

<div class="post-metadata">

**Author:** ![matthewjumps](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@matthewjumps](https://forum.kirupa.com/u/matthewjumps)\
**Post date:** [April 13, 2006, 1:03am UTC](https://forum.kirupa.com/t/reversing-this-zooming-correction-code/184991/4 "2006-04-13T01:03:02Z")

</div>

anyone? it seems that someone else wants this kind of stuff too

> **[Movie clip in the center of the flash animation](https://www.kirupa.com/forum/showthread.php?t=215695)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!
