Actionscript 3 Flex topLevelApplication和SuperTabNavigator鼠标事件处理程序

Actionscript 3 Flex topLevelApplication和SuperTabNavigator鼠标事件处理程序,actionscript-3,apache-flex,actionscript,mouseevent,Actionscript 3,Apache Flex,Actionscript,Mouseevent,我正在使用flexSuperTabNavigator,希望关闭选项卡,检查是否按下了控制按钮。我试过: public static var CONTROL_PRESSED:Boolean = false; public function init():void { var clickListener:Function = function _clickListener(event:MouseEvent):void{ trace(even

我正在使用flex
SuperTabNavigator
,希望关闭选项卡,检查是否按下了控制按钮。我试过:

    public static var CONTROL_PRESSED:Boolean = false;

    public function init():void {
        var clickListener:Function =  function _clickListener(event:MouseEvent):void{
            trace(event.ctrlKey);
            if(event.ctrlKey){
                CONTROL_PRESSED = true;
            }else{
                CONTROL_PRESSED = false;
            }
        };

        FlexGlobals.topLevelApplication.addEventListener(MouseEvent.CLICK, clickListener);

    }

这样做的问题是,除了在选项卡上,应用程序中的任何地方都会调用鼠标单击。我也尝试了相同的代码,但是
addEventListener(MouseEvent.CLICK,clickListener)
将侦听器添加到
SuperTabNavigator
中,但根本不起作用。还有其他方法捕捉鼠标点击吗?

这是因为
SuperTabNavigator
有一个隐藏
鼠标事件的专用鼠标点击处理程序函数:

private function closeClickHandler(event:MouseEvent):void {
    if(this.enabled) {
        dispatchEvent(new Event(CLOSE_TAB_EVENT));
    }
    event.stopImmediatePropagation();
    event.stopPropagation();
}
您需要修改
SuperTabNavigator
源中的
SuperTab
类,以使用所需数据而不是普通的
新事件(CLOSE\u TAB\u Event)
分派一些
CustomEvent

然后更改
SuperTabBar
中的
onCloseTabClicked
功能,了解您的
CustomEvent
。然后,您可以将其传递给应用程序代码(可能通过将其添加到
SuperTabEvent