2015-04-28 47 views
0

在TextFlow上啓用Squiggly後,刪除鍵和箭頭鍵停止工作。如果我點擊或切換應用程序並切換回來,它有時會再次開始工作。如果我不使用Squiggly,刪除和箭頭鍵按預期工作。使用Squiggly啓用拼寫檢查後,刪除鍵和方向鍵停止工作

這裏是代碼我使用,使波浪:

var locale:String = "en_US"; 
SpellUIForTLF.enableSpelling(myTextFlow, locale); 

有沒有人遇到過這一點,有沒有解決?

+0

您有任何問題嗎? – Brian

+0

Naw。我喜歡在網上發佈隨機的東西。你知道海獺每英寸皮膚有超過一百萬根頭髮嗎?人類每英寸有大約100根頭髮。 –

回答

0

它看起來像一個TLF或SpellUIForTLF類的錯誤。在SpellUIForTLF類中有一個方法,叫做「doSpellingJob」。在此調用之後,您要在文本流中重新選擇選擇。

// From customized SpellUIForTLF.as class 
    public function doSpellingJob():void 
    { 
     if (_spellingEnabled == false) return; 

     hh.clearSquiggles(); 
     for (var idx:int = 0; idx < mTextFlow.flowComposer.numControllers; idx++) 
     { 
      var testController:ContainerController = mTextFlow.flowComposer.getControllerAt(idx); 
      //if (getValidFirstWordIndexTLF(testController) != -1) 
       spellCheckRangeTLF(getValidFirstWordIndexTLF(testController), getValidLastWordIndexTLF(testController)); 
     } 

     if (hasEventListener(Event.COMPLETE)) { 
      dispatchEvent(new Event(Event.COMPLETE)); 
     } 


     if (keepFocusOnTextFlow && !calledSetFocusOnce) { 
      setFocusOnTextFlowContainer(); 
      calledSetFocusOnce = true; 
     } 
    } 

    public function setFocusOnTextFlowContainer():void { 
     //trace("Setting focus on textflow"); 
     var testController:ContainerController; 

     if (mTextFlow.flowComposer) { 
      if (mTextFlow.flowComposer.numControllers) { 
       testController = mTextFlow.flowComposer.getControllerAt(0); 
      } 
     } 

     FlexGlobals.topLevelApplication.stage.focus = null; 

     if (testController) { 
      FlexGlobals.topLevelApplication.stage.focus = testController.container; 
     } 

     if (mTextFlow.interactionManager) { 
      //mTextFlow.flowComposer.updateAllControllers(); 
      mTextFlow.interactionManager.setFocus(); 
      var selectionState:SelectionState = mTextFlow.interactionManager.getSelectionState(); 
      //TextObject(currentObject).textFlow.interactionManager.clearSelection(); 
      mTextFlow.interactionManager.selectRange(selectionState.anchorPosition, selectionState.activePosition); 
     } 
    } 


    /** 
    * Sets the focus on the first container controller on the first composition complete. 
    * This is to fix a bug in some situations where the delete and arrow keys do not 
    * work after spell checking has been enabled before the text flow composition 
    * has completed. Usually there is also a delay with editing the first time the dictionary loads. 
    * */ 
    public static var keepFocusOnTextFlow:Boolean; 
    public static var calledSetFocusOnce:Boolean; 

    public function SpellUIForTLF(textModel:TextFlow, lang:String) 
    {  

     ... 
     calledSetFocusOnce = false; 

     if (keepFocusOnTextFlow) { 
      setFocusOnTextFlowContainer(); 
     } 

     ... 
    }