Skip to main content
Inspiring
May 13, 2009
Answered

No more ElementRange in SelectionEvent?

  • May 13, 2009
  • 3 replies
  • 1282 views

Just keeping on top of the nightly builds to make sure I don't slip too far behind, and I've made the relevant changes where EditManager is concerned

noFocusSelectionFormat -> unfocusedSelectionFormat

focusSelectionFormat -> focusedSelectionFormat

selectAll() -> setSelection(0, editManager.absoluteEnd?) (not sure on this one)

But the one that stopped me was that SelectionEvent no longer contained a reference to an ElementRange which I was using heavily to traverse the TLF "DOM", from firstParagraph to lastParagraph.

I've reverted to a previous Gumbo nightly so no problems at all, but I wondered if there was any info on upcoming changes with regards to this last point (getting an ElementRange from a selection)?

This topic has been closed for replies.
Correct answer rdermer

Use the selectionState property of SelectionEvent and call ElementRange.createElementRange.

Hope that helps

Richard

3 replies

Known Participant
October 23, 2009

Hi,

And how can you have the SelectionState with the "old version" of SelectionEvent? (it have only an ElementRange)

It's my actual problem...

Thank you

Adobe Employee
October 23, 2009

You can construct an ElementRange using static function ElementRange.createElementRange.  SelectionState has sufficient information for that.  See the releasenotes for an explanation of the change to SelectionEvent.

Hope that helps,

Richard

Inspiring
May 13, 2009

That got it, I should have seen that. Thanks Richard and Nikos.

rdermerCorrect answer
Adobe Employee
May 13, 2009

Use the selectionState property of SelectionEvent and call ElementRange.createElementRange.

Hope that helps

Richard

Inspiring
May 13, 2009

var selectionState:SelectionState = e.selectionState;

var selectedElementRange:ElementRange = ElementRange.createElementRange(selectionState.textFlow, selectionState.absoluteStart, selectionState.absoluteEnd);

Adobe Employee
May 13, 2009

Yes - that's it.

Sorry for the API churn - there's an API review process that we are following.  Its slowly grinding to a halt though.

Richard