# A little help with some 'zoom code'

**URL:** <https://forum.kirupa.com/t/a-little-help-with-some-zoom-code/158373>\
**Category:** flash\
**Created:** [August 9, 2005, 11:57am UTC](https://forum.kirupa.com/t/a-little-help-with-some-zoom-code/158373 "2005-08-09T11:57:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerry](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jerry](https://forum.kirupa.com/u/jerry)\
**Post date:** [August 9, 2005, 11:57am UTC](https://forum.kirupa.com/t/a-little-help-with-some-zoom-code/158373/1 "2005-08-09T11:57:46Z")

</div>

Hey everybody

I’m kinda stuck right now, and I was hoping someone could give me some advise on how to get this to work.

I’ve got the following AS (applied to a movieclip) for my little zoom function:

```auto
onClipEvent (mouseDown) {
if (k>0) {
return;
}
zoom = true;
dir == 1 ? (dir=-1) : (dir=1);
if (dir == 1) {
pt = {x:_root._xmouse, y:_root._ymouse};
}
}
onClipEvent (enterFrame) {
if (!zoom) {
return;
}
_root._xscale += dir*k*50/8;
_root._yscale += dir*k*50/8;
var pt2 = {x:pt.x, y:pt.y};
_root.localToGlobal(pt2);
_root._x -= (pt2.x-pt.x);
_root._y -= (pt2.y-pt.y);
k++;
if (k == 12) {
zoom = false;
k = 0;
}
}

```

The thing is, that I wan’t it to zoom ONLY when the movieclip is clicked, and not just when clicked on the stage…!? 😑

Hope you guys understand my question - any help would be nice!
