# \[FLASH 8\] MC position's changing at first Zoom attempt

**URL:** <https://forum.kirupa.com/t/flash-8-mc-positions-changing-at-first-zoom-attempt/257302>\
**Category:** flash\
**Created:** [April 12, 2008, 12:21pm UTC](https://forum.kirupa.com/t/flash-8-mc-positions-changing-at-first-zoom-attempt/257302 "2008-04-12T12:21:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rtank](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@rtank](https://forum.kirupa.com/u/rtank)\
**Post date:** [April 12, 2008, 12:21pm UTC](https://forum.kirupa.com/t/flash-8-mc-positions-changing-at-first-zoom-attempt/257302/1 "2008-04-12T12:21:20Z")

</div>

Hi everybody.

I got an mc (named “img”) on the stage. In order to zoom it, I’m using the following code:

```auto
[FONT=monospace][LIST=1]
[*]myZoom = function (myDepth)
[*]{
[*] if (myDepth == "deep")
[*] {
[*] myDepth = 4;
[*] }
[*] else if (myDepth == "medium")
[*] {
[*] myDepth = 8;
[*] }
[*] else if (myDepth == "light")
[*] {
[*] myDepth = 12;
[*] } // end else if
[*] img.onRelease = function()
[*] {
[*] if (k > 0)
[*] {
[*] return;
[*] } // end if
[*] zoom = true;
[*] dir == 1 ? (dir = -1) : (dir = 1);
[*] if (dir == 1)
[*] {
[*] pt = {x: img._xmouse, y: img._ymouse};
[*] } // end if
[*] };
[*] this.onEnterFrame = function ()
[*] {
[*] if (!zoom)
[*] {
[*] return;
[*] } // end if
[*] img._xscale = img._xscale + dir * k * 50 / myDepth;
[*] img._yscale = img._yscale + dir * k * 50 / myDepth;
[*] var pt2 = {x: pt.x, y: pt.y};
[*] img.localToGlobal(pt2);
[*] img._x = img._x - (pt2.x - pt.x);
[*] img._y = img._y - (pt2.y - pt.y);
[*] ++k;
[*] if (k == 8)
[*] {
[*] zoom = false;
[*] k = 0;
[*] } // end if
[*] };
[*]};
[*]myZoom("medium");[/LIST][/FONT]

```

Problem is, when I release on the mc it changes its original position to X=0,0 Y=0,0 as you can see [HERE](http://www.fileden.com/files/2007/5/1/1036166/Zoom.swf).  
Obviously, I want it to keep its starting position on the stage and zooming IN and OUT from there.

Thanks to anyone who may help.
