Actionscript 3 使用Squiggly启用拼写检查后,删除键和箭头键停止工作

Actionscript 3 使用Squiggly启用拼写检查后,删除键和箭头键停止工作,actionscript-3,apache-flex,flex4,squiggly,Actionscript 3,Apache Flex,Flex4,Squiggly,在文本流上启用Squiggly后,delete键和箭头键停止工作。如果我点击周围或切换应用程序并切换回,它有时会重新开始工作。如果我根本不使用Squiggly,则删除键和箭头键将按预期工作 下面是我用来启用Squiggly的代码: var locale:String = "en_US"; SpellUIForTLF.enableSpelling(myTextFlow, locale); 有人遇到过这个问题吗?有没有修复方法?它看起来像是TLF或SpellUIForTLF类的bug。在Spell

在文本流上启用Squiggly后,delete键和箭头键停止工作。如果我点击周围或切换应用程序并切换回,它有时会重新开始工作。如果我根本不使用Squiggly,则删除键和箭头键将按预期工作

下面是我用来启用Squiggly的代码:

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

有人遇到过这个问题吗?有没有修复方法?

它看起来像是TLF或SpellUIForTLF类的bug。在SpellUIForTLF类中,有一个名为“DoSpillingJob”的方法。在此调用之后,您需要在textflow中重新选择所选内容

    // 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();
        }

        ...
    }
//来自自定义的SpellUIForTLF.as类
公共函数doSplingJob():void
{
if(_spellingEnabled==false)返回;
hh.clearSquiggles();
对于(变量idx:int=0;idx
你有什么问题吗?没有。我喜欢在网上随意发布东西。你知道海獭每英寸皮肤上有超过一百万根头发吗?人类每英寸大约有100根头发。