# Scale, Center, and Move based on clicked spot

**URL:** <https://forum.kirupa.com/t/scale-center-and-move-based-on-clicked-spot/223233>\
**Category:** flash\
**Created:** [April 20, 2007, 1:23pm UTC](https://forum.kirupa.com/t/scale-center-and-move-based-on-clicked-spot/223233 "2007-04-20T13:23:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MattyG](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mattyg/32/868_2.png) [@MattyG](https://forum.kirupa.com/u/MattyG)\
**Post date:** [April 20, 2007, 1:23pm UTC](https://forum.kirupa.com/t/scale-center-and-move-based-on-clicked-spot/223233/1 "2007-04-20T13:23:36Z")

</div>

So I’ve got this script inside of a movie clip that takes this movie clip and scales it/re-centers it. What I’d really like to do is make the center point of that movie clip be where the mouse is clicked when it scales “in”.

Any suggestions?

```auto

var dubClick = "in"; // double click toggle variable

//click variables
_global.xScaleOg = container._xscale;
_global.yScaleOg = container._yscale;
_global.xLocationOg = container._x;
_global.yLocationOg = container._y;

container.onPress = function() {

    if(dubClick == "in") {
        new mx.transitions.Tween(container, "_xscale", mx.transitions.easing.Strong.easeOut, container._xscale, xScaleOg*2, 20, false);
        new mx.transitions.Tween(container, "_yscale", mx.transitions.easing.Strong.easeOut, container._yscale, yScaleOg*2, 20, false);
        new mx.transitions.Tween(container, "_x", mx.transitions.easing.Strong.easeOut, _global.xLocationOg, _global.xLocationOg-(container._width/2), 20, false);
        new mx.transitions.Tween(container, "_y", mx.transitions.easing.Strong.easeOut, _global.yLocationOg, _global.yLocationOg-(container._height/2), 20, false);
        _root.screen_mc.dubClick = "out";
        
    } else {
        new mx.transitions.Tween(container, "_xscale", mx.transitions.easing.Strong.easeOut, container._xscale, _global.xScaleOg, 20, false);
        new mx.transitions.Tween(container, "_yscale", mx.transitions.easing.Strong.easeOut, container._yscale, _global.yScaleOg, 20, false);
        new mx.transitions.Tween(container, "_x", mx.transitions.easing.Strong.easeOut, this._x, _global.xLocationOg, 20, false);
        new mx.transitions.Tween(container, "_y", mx.transitions.easing.Strong.easeOut, this._y, _global.yLocationOg, 20, false);
        _root.screen_mc.dubClick = "in"
    }
}

```
