Skip to main content
Inspiring
Sep 10, 2009 10:29 AM UTC
Answered

SelectionEvent Problem

Hi i have added following to get selection

textFlow.addEventListener(SelectionEvent.SELECTION_CHANGE, selectionHandler);

function selectionHandler(ev:SelectionEvent):void {

trace(ev.type);

/*var range:ElementRange = ev.selectionState ?

                ElementRange.createElementRange(ev.selectionState.textFlow,

                ev.selectionState.absoluteStart, ev.selectionState.absoluteEnd) : null;

               trace("Starting index of selection range: " + range.absoluteStart);

               trace("Ending index of selection range: " + range.absoluteEnd);*/

}

when i uncomment from above code it gives this error
1119: Access of possibly undefined property selectionState through a reference with static type flashx.textLayout.events:SelectionEvent.
can you please tell my what i need to fix
Thanks
This topic is closed to new replies. Start a new post to keep the conversation going.
robin_briggsCorrect answer
Adobe Employee
Sep 14, 2009 11:05 PM UTC

First, I would suggest you try upgrading to a newer version of TLF, if you are using the one we posted to the Labs site last November that works with the Flash CS4 Component.

If you change this line:

    EditManager(textFlow.interactionManager).modifyInlineGraphic(null,e.target.value,e.target.value);

and add an additional argument that specifies the location of the inline graphic you want to change as a SelectionState, it should work:

     EditManager(textFlow.interactionManager).modifyInlineGraphic(null,e.target.value,e.target.value, new SelectionState(textFlow, 15, 15));

for example if your inline graphic is at absolute position 15 in the text flow.

- robin

5 replies

Adobe Employee
Sep 10, 2009 4:26 PM UTC

This code compiles and runs OK for me. I retyped it, so perhaps I corrected a typo I don't see here. Do you have all the imports you need declared?

Translate
chicflashAuthor
Inspiring
Sep 13, 2009 6:27 AM UTC

Hi

Please check this attached file i want to select my inlinegraphic just on click over it and apply modifyinlinegraphic command. but image is only selected if click in this way that cursor move to at image index. (movieclip click event is called)

Translate