2013-03-06 39 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