AS文本框焦点获取

时间:2022-06-25 19:52:23

AS2:

txt.onSetFocus = function ()
{
//当得到focus(聚集)时调用。
};
txt.onKillFocus = function ()
{
//当失去focus(聚集)时调用。
};

AS3:
dispatcher.addEventListener(FocusEvent.FOCUS_IN, focusInHandler);//得到
dispatcher.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);//失去
dispatcher.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
dispatcher.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);