Flex将stage.mouseChildren设置为false可防止使用忙碌光标

时间:2013-03-06 15:11:53

标签: flex cursor

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

protected function setBusyCursor() : void {

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

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

2 个答案:

答案 0 :(得分:0)

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

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

答案 1 :(得分:0)

最后我设法用这个来做:

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;
            }
        }

    }

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