Skip to main content
Participant
September 10, 2009
Question

Image Selection Help Needed

  • September 10, 2009
  • 1 reply
  • 498 views

Hi

i am trying to select my inline graphic after it is added to textflow.

using filerefrence once image is loaded and following funcion is to handle this

function imageLoadComplete(e:Event):void {

     imgLdr.contentLoaderInfo.removeEventListener(Event.COMPLETE,imageLoadComplete);

     var mc:MovieClip = new MovieClip();

     mc.addChild(imgLdr.content);

     mc.addEventListener(MouseEvent.CLICK,imageClicked);

     EditManager(textFlow.interactionManager).insertInlineGraphic(mc,100,100);

     textFlow.flowComposer.updateAllContainers();

}

when i click on image event is called. after click i passed this image to resize handler and here is to resize this. but it handles  image only if cursor is at side of the image or image is selected in a way that it is highlighted. other wise modifyinlinegraphic is not working for me if i pass my movieclip refrence.

Please help i have spen more than 10 hrs to figure out this problem

Thanks

This topic has been closed for replies.

1 reply

Adobe Employee
September 10, 2009

I think most likely the problem is that you are not passing an explicit operationState. That is the last parameter in EditManager.modifyInlineGraphic, and if it is left out, then TLF will use the current selection as the location of the inline graphic. If you want to modify an inline graphic at a particular location, you should create a SelectionState at that location, and pass that as the operationState.

Suppose the inline is the first thing in the TextFlow. Then you could do this as follows:

     var selectionState:SelectionState = new SelectionState(textFlow, 0, 0);

     IEditManager(textFlow.interactionManager).modifyInlineGraphic("source", 100, 100, null, selectionState);

Then it should find the inline graphic at the start of the TextFlow, regardless of where the current selection is.

If this does not sound like the problem you are having, please send a code snippet for the event listener where you call to modifyInlineGraphic.

- robin