# Scale MC on \_x & \_y mouse movement?

**URL:** <https://forum.kirupa.com/t/scale-mc-on--x--y-mouse-movement/255782>\
**Category:** flash\
**Created:** [March 26, 2008, 9:47pm UTC](https://forum.kirupa.com/t/scale-mc-on--x--y-mouse-movement/255782 "2008-03-26T21:47:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dark\_Angel](https://avatars.discourse-cdn.com/v4/letter/d/9f8e36/32.png) [@Dark\_Angel](https://forum.kirupa.com/u/Dark_Angel)\
**Post date:** [March 26, 2008, 9:47pm UTC](https://forum.kirupa.com/t/scale-mc-on--x--y-mouse-movement/255782/1 "2008-03-26T21:47:18Z")

</div>

Hello,

I have a problem with a button i want to create. I want different buttons (simple circles) that become bigger and 100% visible when the mouse becomes closer (at a certain distance), visa versa. till 0% visibility

Searched on forumI found this couldn’t find anything helpful. I found the code here below, but i don’t fully understand it to change the code. I tried changing it in many (probably very bad) way’s, as result that it only got worser… ☹

Frame 1:

```auto
 //this objects x position
posx = this._x;
//reaction boundaries
lbound = (posx - 50);
rbound = (posx + 50);
//default scale
z = 100;
n = 150;
//scale calcs
upscale = z+(posx-_xmouse);
downscale = n-(_xmouse-posx);
//mouse reactions...
if (_xmouse<lbound) {
    (this._yscale=z), (this._xscale=this._yscale);
    }
if (_xmouse>rbound) {
    (this._yscale=z), (this._xscale=this._yscale);
    }
if (_xmouse>lbound && _xmouse<=posx) {
    (this._yscale=upscale), (this._xscale=this._yscale);
    }
if (_xmouse>posx && _xmouse<rbound) {
    (this._yscale=downscale), (this._xscale=this._yscale);
}

```

Frame 2:

```auto
gotoAndPlay(1)

```

Can someone please help me?

Thanks,  
DA
