# Scaling on-screen textfield by dragging in runtime

**URL:** <https://forum.kirupa.com/t/scaling-on-screen-textfield-by-dragging-in-runtime/332397>\
**Category:** Uncategorized\
**Created:** [May 23, 2014, 10:32am UTC](https://forum.kirupa.com/t/scaling-on-screen-textfield-by-dragging-in-runtime/332397 "2014-05-23T10:32:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adBuryD](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@adBuryD](https://forum.kirupa.com/u/adBuryD)\
**Post date:** [May 23, 2014, 10:32am UTC](https://forum.kirupa.com/t/scaling-on-screen-textfield-by-dragging-in-runtime/332397/1 "2014-05-23T10:32:19Z")

</div>

hi  
I am trying to make a textfield which could be resized as desired. I have managed to achieve this. But the dragging of the movieclip that acts as the scrubber on the bottom of right-hand corner causes a lag in the resizing of the textfield itself.  
Is there any way to fix this.  
Thanks in advance for your help. The code is as below. Alos attaching the fla.

```auto

scrub.alpha=0;
scrub.addEventListener(MouseEvent.MOUSE_OVER, showScrub)
scrub.addEventListener(MouseEvent.MOUSE_OUT, hideScrub)
function showScrub(e:MouseEvent){
    scrub.alpha=1;
    scrub.addEventListener(MouseEvent.MOUSE_DOWN,dragScrub)
    scrub.addEventListener(MouseEvent.MOUSE_UP,unDragScrub)
}
function dragScrub(e:MouseEvent){
    scrub.startDrag();
    scrub.addEventListener(Event.ENTER_FRAME, update);
}
function unDragScrub(e:MouseEvent){
    scrub.stopDrag();
}
function hideScrub(e:MouseEvent){
    scrub.alpha=0;
}

function update(e:Event){
    
    var mousex = scrub.x;
    var mousey = scrub.y;
    var mcX = mc.x;
    var mcY = mc.y;
    var projectedWidth = mousex-mcX;
    var projectedHeight = mousey-mcY;
    mc.width = projectedWidth;
    mc.txt.width = mc.width;
    mc.height = projectedHeight;
    mc.txt.height = mc.height;
    trace(projectedWidth)
}

```
