2015-06-26 90 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正在赶上一些关键事件。