View Full Version : detecting onMouseDown in a text field
i have the following code:
textListener = new Object();
textListener.onMouseDown = function() {
if(Selection.getFocus() == "_level0.controller.xmlInput_txt")
trace("mousedown");
}
Mouse.addListener(textListener);
it does not detect the mousedown in the textfield on the first press - it works fine after the first press - so second, third etc.
any ideas?
thank you in advance
flashead
02-10-2006, 04:46 PM
you can try the TextField's onSetFocus handler.
xmlInput_txt.onSetFocus = function()
{
trace( this._name + " focused" );
};
k.
thank you flashead, i used the trace and then got a partial answer to why it was not working (the same problem exists with your solution - which is great btw).
on the first click this._name = xmlInput_txt
on the second and subsequent clicks this._name = _level0.controller.xmlInput_txt
so after the first click the full path is used (which is what i test for).
i do not understand why it would not give me the full path on the first click (very odd) ?
thank you for you help and if any other ideas spring to mind that would be great
thank you again
flashead
02-10-2006, 05:27 PM
that's strange, the _name property should never return a target path?
tracing 'this' would return the full path, but the _name just grabs the instance name of that mc.
can you post the file?
k.
thanks again - i have spent time going over the code, playing around with etc. and now i cant duplicate it (i assume that i had a Selection.getFocus hanging around).
the easiest thing to do is describe what i am trying to achieve:
input field on screen - type in a filename and press enter.
1. further processing on detection of the enter
2. make sure the field is cleared out prior to the user typing in it (so detect the mousedown in the field?)
its as simple as that (but it doesnt seem like it)
thank you for you help so far it is very much appreciated.
xmlInput_txt.onSetFocus = function()
{
xmlInput_txt.text="";
};
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.