2015-06-26 100 views
0

我正在flexbuilder 3中開發。我正在使用Flex 3.5進行編譯。如何找到什麼是在AS3中劫持退格鍵?

東西是劫持我的退格鍵,我找不到罪魁禍首。在我輸入某些字符然後嘗試鍵入退格鍵的文本字段中,有些事件觸發了試圖在屏幕上的其他位置更改Tabnavigator。這迫使是「作秀活動」,在展會代碼,我拋出一個堆棧跟蹤,顯示

Error: StackTrace 
at OrderInq/populate_Addresses()[I:\AmeriLawyerNew\src\OrderInq.as:669] 
at OrderInq/__tab_address_show()[I:\AmeriLawyerNew\src\OrderInq.mxml:83] 
at flash.events::EventDispatcher/dispatchEventFunction() 
at flash.events::EventDispatcher/dispatchEvent() 
at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9440] 
at mx.core::UIComponent/setVisible()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1913] 
at mx.core::UIComponent/set visible()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1881] 
at mx.containers::ViewStack/updateDisplayList()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\containers\ViewStack.as:864] 
at mx.containers::TabNavigator/updateDisplayList()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\containers\TabNavigator.as:626] 
at mx.core::UIComponent/validateDisplayList()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:6362] 
at mx.core::Container/validateDisplayList()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\Container.as:2720] 
at mx.managers::LayoutManager/validateDisplayList()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:622] 
at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:695] 
at Function/http://adobe.com/AS3/2006/builtin::apply() 
at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8744] 
at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8684] 

我的下一個嘗試是創建一個按鍵事件偵聽等;

this.addEventListener(KeyboardEvent.KEY_DOWN, interceptKey, true); 
private function interceptKey(evt:KeyboardEvent):void 
{ 
    if(evt.keyCode == 8) // Backspace key 
    { 
     trace("Main Backspace key detected"); 
    } 
    trace('Main evt.keyCode=' + evt.keyCode); 
} 

這會顯示每個擊鍵正確,除了退格。當我在跟蹤中輸入退格時,什麼都沒有顯示出來。退格不會刪除文本框中的字符,但似乎會觸發某些事件。

有沒有辦法跟蹤發生的事件?

有沒有辦法查看哪些事件監聽器在監聽?

我該如何去調試這個問題?

Paul

+0

發現,如果我點擊Web瀏覽器/閃光窗口,然後返回,退格按原樣工作。 –

+0

很奇怪。所以我明白你有一個TabNavigator你的TextField?只是瘋狂的猜測,但嘗試將TabNavigator上的historyManagementEnabled屬性設置爲false。你在Flash播放器或瀏覽器中測試過嗎?如果它是瀏覽器,你是否用不同的瀏覽器試過了? – Philarmon

+0

Philarmon請將您的評論更改爲答案,因爲這似乎解決了問題。 –

回答

1

所以我明白你有你的TextField在TabNavigator?只是瘋狂的猜測,但嘗試將TabNavigator上的historyManagementEnabled屬性設置爲false。 TabNavigator正在趕上一些關鍵事件。