Skip to main content
Inspiring
September 10, 2009
解決済み

SelectionEvent Problem

  • September 10, 2009
  • 返信数 1.
  • 1243 ビュー

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
このトピックへの返信は締め切られました。
解決に役立った回答 robin_briggs

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

返信数 1

Adobe Employee
September 10, 2009

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?

chicflash作成者
Inspiring
September 13, 2009

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)