2012-03-18 21 views
0

當我把注意力放在輸入文字上時,我得到錯誤#1023。 有什麼幫助嗎?注重輸入文字

mc.tabChildren = true; 
mc.tabEnabled = true; 
mc.getInputTxt().tabIndex = 0 

mc.addEventListener(FocusEvent.FOCUS_IN,updateFocus); 

private function updateFocus(e:FocusEvent):void{ 
stage.focus = e.currentTarget.getInputTxt() 
} 

回答

0

堆棧溢出,無限循環。

if (stage.focus != e.currentTarget.getInputTxt()) 
    stage.focus = e.currentTarget.getInputTxt(); 

或者:

if (e.target == e.currentTarget.getInputTxt()) 
    return; 

stage.focus = e.currentTarget.getInputTxt(); 
+0

它didn't工作。 我都試過了。 我認爲這是關於Flash組件TextInput。它有一些繪製(也許movieclip)。 錯誤#1023: \t在fl.core :: UIComponent/getDisplayObjectInstance() There's後說了很多,但它doesn't適合在評論 – 2012-03-18 20:48:22

+0

從來就明白了。 我必須設置具有輸入文本組件選項卡索引的mc – 2012-03-18 21:00:15

+0

@MarceloNoronha如果(e.target!= e.currentTarget)返回;'?完整的堆棧跟蹤將有所幫助。 – Manish 2012-03-18 21:03:13