# Draggable input textfield

**URL:** <https://forum.kirupa.com/t/draggable-input-textfield/173146>\
**Category:** Uncategorized\
**Created:** [December 21, 2005, 5:46pm UTC](https://forum.kirupa.com/t/draggable-input-textfield/173146 "2005-12-21T17:46:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixeldude](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@pixeldude](https://forum.kirupa.com/u/pixeldude)\
**Post date:** [December 21, 2005, 5:46pm UTC](https://forum.kirupa.com/t/draggable-input-textfield/173146/1 "2005-12-21T17:46:31Z")

</div>

Hello there…

okay here I just pick up tje code from this forum …somewhere i forgot…ok it’s work great…the problem is I try using button to create the draggable textfield it’s appear but can’t be drag anymore…so what’s wrong with the code…and one more thing…what I want is that I can create many textfield just by pressing the btn…is it possibile…in different coordinate…

this is the code

```auto

function createtxt(){
    this.createEmptyMovieClip('but_mc', 2);
    this.createTextField('the_txt', 1,0, 0, 100, 20);

    the_txt.type = "input";
//the_txt.text = "test";
    the_txt.autoSize = "center";
    the_txt.wordWrap = true;
    the_txt.border = true;
    the_txt.multiline = true;
    the_txt.onChanged = function() {
        but_mc._width = this._width;
        but_mc._height = this._height;
    };
    but_mc._alpha = 0;
    but_mc.lineStyle(1, 0xFF0000, 100);
    but_mc.moveTo(0, 0);
    but_mc.beginFill(0xFFFFFF);
    but_mc.lineTo(100, 0);
    but_mc.lineTo(100, 20);
    but_mc.lineTo(0, 20);
    but_mc.lineTo(0, 0);
    but_mc.endFill();
}

createtxt();

but_mc.onPress = function() {
    
    this.startDrag();
    
};

but_mc.onRelease = but_mc.onReleaseOutside=function () { 
                        this.stopDrag();
                        Selection.setFocus(the_txt);
                        Selection.setSelection(the_txt.length, the_txt.length);
};

this.onMouseMove = function() {
    the_txt._x = but_mc._x;
    the_txt._y = but_mc._y;
    updateAfterEvent();
};

```

tq
