>>I Made a Draggable Inputtext but when I drag it I can
not write into it ,I
>>try
to put a button beside input text and put the Drag action in
the button ,it
works fine but ,is there any way to make the Draggable Input
text by itself
without the button beside it
<<
Right, probably you put the input text into a movie clip and
then assigned
onPress and onRelease events? Then the mc containing the text
absorbs the
mouse events so your input field can't get the focus. You can
get around
this fairly easily using a mouse listener that just moves the
field with the
mouse. I have an input text field with an instance name of
dragText, and the
code below is on frame 1. Note in the MouseMove test I am
also testing to
see if the control key is down - I added this to allow the
mouse to still
function normall to select text for editing, but move the
field when control
is down.
var mouseListener:Object = new Object();
mouseListener.onMouseDown = function() {
this.deltaX = _xmouse - dragText._x;
this.deltaY = _ymouse - dragText._y;
this.dragging = true;
};
mouseListener.onMouseUp = function() {
this.dragging = false;
};
mouseListener.onMouseMove = function() {
if((_xmouse >= dragText._x) && (_xmouse <=
dragText._x + dragText._width)
&& (_ymouse >= dragText._y) && (_ymouse
<= dragText._y + dragText._height)
&& this.dragging && Key.isDown(Key.CONTROL)){
dragText._x = _xmouse - this.deltaX;
dragText._y = _ymouse - this.deltaY;
}
};
Mouse.addListener(mouseListener);
--
Dave -
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/