# Scale From Center After Drag

**URL:** https://forum.kirupa.com/t/scale-from-center-after-drag/309673
**Category:** flash
**Created:** [May 21, 2010, 7:03am UTC](https://forum.kirupa.com/t/scale-from-center-after-drag/309673 "2010-05-21T07:03:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tcambron](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@tcambron](https://forum.kirupa.com/u/tcambron)
#### Post date: [May 21, 2010, 7:03am UTC](https://forum.kirupa.com/t/scale-from-center-after-drag/309673/1 "2010-05-21T07:03:45Z")

</div>

I have an image inside a movie clip that a user can scale from its center using the slider…works great. However the use can also drag the movie clip. After the movie clip is dragged to a new location it and then scaled using the slider it jumps back to the center of the stage and then scales. I have tried modifying the x y of the movie clip but then the scale is no longer from the movie clip’s center. Any ideas?

var clipNativeX = holder\_mc.x;  
var clipNativeY = holder\_mc.y;

function scaleClip(val:int):void  
{  
var trueScl:Number = val/100; // val is the value from the slider  
holder\_mc.scaleX = holder\_mc.scaleY = trueScl;  
// I think the problem is here but not sure how to fix  
holder\_mc.x = clipNativeX-(holder\_mc.width/2);  
holder\_mc.y = clipNativeY-(holder\_mc.height/2);  
defineCrop()  
}
