Search code examples
tlf

Call to a possibly undefined method setSelection through a reference with static type SelectionManager


I'm working with an TLF example (older version) and I'm getting errors when I try to run it:

1061: Call to a possibly undefined method setSelection through a reference with static type flashx.textLayout.edit:ISelectionManager.

_textFlow.interactionManager.setSelection(0,0);

Solution

  • I found an updated example here that contains some of the names of the classes that have been renamed:

    • TextFilter => TextConverter
    • ChangeElementIdOperation => ApplyElementIDOperation
    • DisplayObjectContainerController => ContainerController
    • ChangeElementStyleNameOperation => ApplyElementStyleNameOperation
    • flashx.textLayout.BuildInfo.kBuildNumber => TextLayoutVersion.getVersionString(TextLayoutVersion.CURRENT_VERSION)
    • textFlow.interactionManager.setSelection(0,0) =>_textFlow.interactionManager.setRange(0,0)
    • e.selectedElementRange.paragraphFormat =>
      var selectionState:SelectionState = e.selectionState;
      var selectedElementRange:ElementRange = ElementRange.createElementRange(selectionState.textFlow, selectionState.absoluteStart, selectionState.absoluteEnd);
    • textFlow.computedTextLayoutFormat => textFlow.computedFormat

    I found an updated example of this project on the Apache Flex SDK in the directory flex-tlf/sdk/samples/flex/SimpleEditorWithCSS.