[quoted text, click to view] "buraksan" <burak.sandiraz@sbs.com.tr> wrote in message
news:d43dcv$i89$1@forums.macromedia.com...
>i am in trouble with writing something to draggable movie clips.
> make a movie clip..say its name "a_mc"
> place a textinput component on it.
> and write in maintimeline frame:
>
> a_mc.onPress = null
>
> then see that textinput does not take focus..any help will be...
You have to wait until mouse is up to set the focus, otherwise it will
jump to the clip you are clicking on instead of the text box.
Here is an example of two movieclips a_mc and b_mc that are draggable.
Each has an input text box with an instance name of "box".
// all code on main timeline.. not attached to any objects
_root.onMouseDown = function() {
if (a_mc.hitTest(_root._xmouse, _root._ymouse, true))
a_mc.startDrag();
if (b_mc.hitTest(_root._xmouse, _root._ymouse, true))
b_mc.startDrag();
}
_root.onMouseUp = function() {
if (a_mc.hitTest(_root._xmouse, _root._ymouse, true))
Selection.setFocus("a_mc.box");
if (b_mc.hitTest(_root._xmouse, _root._ymouse, true))
Selection.setFocus("b_mc.box");
stopDrag();
}
_root.onMouseMove = function() {
updateAfterEvent(); // much smoother with this
}
Whenever you click the mouse, a check is made to see if the mouse is
over either of the two movieclips. If it is, it starts drag for that
movieclip. When the mouse button is released, the focus is given to
the movieclip's text box that has the mouse over it.
Hope that helps.
tralfaz