PDA

View Full Version : Detecting click on textbox?



Limitlis
June 6th, 2005, 04:42 PM
Is there a way to detect if a user has clicked on a textbox or if a certain textbox is active? IM NOT USING MX 2004 COMPONENTS. Im using just MX components.

Would I need to set up a listener for this?

Thanks,
Limitlis

Limitlis
June 6th, 2005, 06:33 PM
Hate to bother with this but I cant seem to figure it out. And my searches i guess arent doing it either. :wasted:

SO i found this http://www.kirupa.com/developer/actionscript/asbroadcaster.htm

and in the table there was this one...

onSetFocus

how would this be scripted? anyone?
Something like this?


textboxName.onSetFocus{

function here();
}


I've just never scripted with this stuff before.

Also, since the script cant go directly on the input box, would it be a frame script?

Thx in advanced.

nathan99
June 6th, 2005, 06:37 PM
it would be on there frame the text box is in, hence the path

textboxName.onSetFocus{

Limitlis
June 6th, 2005, 06:51 PM
Hey Nathan thanks.

yeah i sortof managed to get a simplified version of what Im looking for using this



testbox.onSetFocus = function( oldFocus){
trace("blah!");
testbox.borderColor = 0xCCAA00;
testbox.backgroundColor = 0xDDBB33;
testbox.textColor = 0xFFFFFF;
};

testbox.onKillFocus = function ( newFocus ) {
testbox.borderColor = 0x000000;
testbox.backgroundColor = 0xFFFFFF;
testbox.textColor = 0x000000;

};


Do you know of an easy way to applythis to any textfield in the file? Or even just within that frame.

For instance if this was in a form with several input boxes. Would I need to just C&P this snippet to for every single instance that i have? There has a be an easier way.

Thanks All!