2013-03-06 40 views
0

我试图禁用鼠标单击并从UIComponent外部显示忙光标。即时做到这一点:Flex设置stage.mouseChildren为false可防止使用忙光标

protected function setBusyCursor() : void { 

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

这确实禁用鼠标单击,但光标出现是正常指针(不忙)。任何想法,我做错了什么?

回答

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

    } 

禁用它在屏幕上的所有鼠标点击,并把繁忙的光标。

0

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

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

谢谢伊利亚,但它并没有禁用鼠标点击(光标很忙),IM与Flash Builder 4.5。而不是在这个组件上,而是在一个外部的控制器上做任何想法? – 2013-03-06 15:44:20

+0

我编辑了答案,试试吧。 – 2013-03-06 15:51:31

+0

这也不起作用。你知不知道为什么它在舞台上表演而不是这样? – 2013-03-06 15:57:37