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
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