【问题标题】:Show the submenu on mouse over instead of mouse click in MenuBar in Flex 4.6在 Flex 4.6 的 MenuBar 中显示鼠标悬停而不是鼠标单击的子菜单
【发布时间】:2015-09-22 11:06:59
【问题描述】:

我正在使用 Flex 4.6 Web 应用程序。当我单击该子菜单时,我有一个菜单栏,它在鼠标悬停后打开。现在的问题是,当我将鼠标悬停在菜单栏子菜单上时,我希望它在鼠标悬停时打开而不是单击。我该怎么做。请给我你的建议。

谢谢 比克兰特辛格

【问题讨论】:

    标签: actionscript-3 apache-flex flex4 flex4.5 flex4.6


    【解决方案1】:

    你可以这样使用 MOUSE_OVER 事件

        <mx:MenuBar id="menuBar" creationComplete="onMenuComplete(event)" />
    
    
    
        private function onMenuComplete(event:FlexEvent) {
            menuBar.addEventListener(MouseEvent.MOUSE_OVER, onMenuRollOver, true);
    
        }
    
        private function onMenuRollOver(event:MouseEvent):void {
            if (event.target is IMenuBarItemRenderer && menuBar.selectedIndex == -1) {
                var index:int = IMenuBarItemRenderer(event.target).menuBarItemIndex;
                menuBar.selectedIndex = (index == 0) ? 1 : 0;
            }
        }
    

    但如果你也想隐藏它,你应该使用 MOUSE_OUT 事件

    【讨论】:

    • 非常感谢它的工作文件...Vasil Medvedev。
    • 能否提供在 MOUSE_OUT 上隐藏此菜单的代码。
    猜你喜欢
    • 2012-12-16
    • 1970-01-01
    • 2017-04-30
    • 1970-01-01
    • 1970-01-01
    • 2013-03-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多