【问题标题】:Flex setting stage.mouseChildren to false prevents the use of busy cursorFlex 将 stage.mouseChildren 设置为 false 可防止使用繁忙光标
【发布时间】:2013-03-06 15:11:53
【问题描述】:

我试图禁用鼠标单击并在 UIComponent 外部显示忙碌光标。我正在这样做:

protected function setBusyCursor() : void {

        const stage:Stage = mx.core.FlexGlobals.topLevelApplication.stage;
        if (stage){
            stage.mouseChildren = false;
        }
        CursorManager.setBusyCursor();
    }

这确实禁用了鼠标单击,但出现的光标是常规指针(不是忙碌的指针)。知道我做错了什么吗?

【问题讨论】:

    标签: apache-flex cursor


    【解决方案1】:

    需要所有代码,我测试了 4.5.1 flex 框架,工作完美。使用:

    protected function setBusyCursor() : void 
    {       
        FlexGlobals.topLevelApplication.mouseChildren = false;
        CursorManager.removeAllCursors();
        CursorManager.setBusyCursor();
    }
    

    【讨论】:

    • 感谢 Ilya,但它不会禁用鼠标单击(虽然光标很忙),我使用的是 flash builder 4.5。并且不是在 uicomponent 上而是从外部控制器执行此操作,有什么想法吗?
    • 这也不起作用。你知道为什么当我在舞台上做而不是这样时它会起作用吗?
    • 这也不起作用(禁用鼠标但没有忙碌的光标),感谢您的建议。
    【解决方案2】:

    最后我设法做到了:

    protected function setBusyCursor() : void 
        {   
            var i : int = 0;
            var uiComponent : UIComponent = FlexGlobals.topLevelApplication.parent.getChildAt(i);
            while (uiComponent != null){
                uiComponent.mouseChildren = false;
                uiComponent.cursorManager.setBusyCursor();
                i+=1;
                if ( FlexGlobals.topLevelApplication.parent.getChildAt(i) is UIComponent) {
                    uiComponent = FlexGlobals.topLevelApplication.parent.getChildAt(i);
                }
                else {
                    uiComponent = null;
                }
            }
        }
    
        protected function removeBusyCursor() : void {
            var i : int = 0;
            var uiComponent : UIComponent = FlexGlobals.topLevelApplication.parent.getChildAt(i);           
            while (uiComponent != null){
                uiComponent.cursorManager.removeBusyCursor();
                uiComponent.mouseChildren = true;
                i+=1;
                if ( FlexGlobals.topLevelApplication.parent.getChildAt(i) is UIComponent) {
                    uiComponent = FlexGlobals.topLevelApplication.parent.getChildAt(i);
                }
                else {
                    uiComponent = null;
                }
            }
    
        }
    

    它禁用屏幕上的所有鼠标点击并放置忙碌光标。

    【讨论】:

      猜你喜欢
      • 2014-11-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多