如何select TLF中的流程元素?

How to select a flow element in TLF?

是否有一种方法可以用于 select FlowElement?我检查了一些 类,包括 SelectionManager 和 EditManager,但没有看到任何东西。

以下示例显示如何 select 一个元素:

<fx:Script>
    <![CDATA[
        import flashx.textLayout.edit.ISelectionManager;
        import flashx.textLayout.edit.SelectionState;
        import flashx.textLayout.elements.FlowElement;
        import flashx.textLayout.elements.TextFlow; 

        protected function selectElementHandler(event:MouseEvent):void {
            var selectionManager:ISelectionManager = activeFlow.interactionManager as ISelectionManager;
            var element:FlowElement = activeFlow.findLeaf(selectionManager.anchorPosition);
            selectElement(element);
        }

        public function selectElement(flowElement:FlowElement):void { 
            var textFlow:TextFlow = flowElement.getTextFlow();
            var selection:SelectionState = ISelectionManager(textFlow.interactionManager).getSelectionState();
            var startIndex:int = flowElement.getAbsoluteStart();
            selection.updateRange(startIndex, startIndex + flowElement.textLength);
            IEditManager(textFlow.interactionManager).setSelectionState(selection);
            textFlow.flowComposer.updateAllControllers();
        }
    ]]>
</fx:Script>

<s:Button label="Select current element" click="selectElementHandler(event)"/>