Skip to main content
April 8, 2009
Question

Not showing InlineGraphic until I "realign text"

  • April 8, 2009
  • 1 reply
  • 957 views

private function handler_insertInlineGraphic( event:RichTextEditorEvent ):void
        {
            var loader:Loader = new Loader();
            loader.contentLoaderInfo.addEventListener( Event.COMPLETE, handler_inlineGraphicLoaderComplete );
            loader.load( new URLRequest( event.value as String ) );
        }
       
        private function handler_inlineGraphicLoaderComplete( event:Event ):void
        {           
            var bmd:BitmapData = Bitmap( event.target.content ).bitmapData;
            var bm:Bitmap = new Bitmap( bmd );           
            EditManager( _textFlow.interactionManager).insertInlineGraphic( bm, bm.width, bm.height );
            _textFlow.interactionManager.setSelection( 0, 0 );   
            _textFlow.flowComposer.updateAllContainers();
            //_textFlow.interactionManager.setFocus();   
               
        }

This methos places the image and the space inside the TextFlow, but the space is blank until I do some kind of modification to the text, turn it bold, anything, then I can see the image.

any idea?

This topic has been closed for replies.

1 reply

April 8, 2009

private function handler_inlineGraphicLoaderComplete( event:Event ):void
{           
      var bmd:BitmapData = Bitmap( event.target.content ).bitmapData;
      var bm:Bitmap = new Bitmap( bmd );           
      IEditManager( _textFlow.interactionManager).insertInlineGraphic( bm, bm.width, bm.height );
     IEditManager( _textFlow.interactionManager ).applyParagraphFormat( new ParagraphFormat() );
      _textFlow.flowComposer.updateAllContainers();

}

This line corrects the problem, but I think I'm forcing it, there's any other way?

Adobe Employee
April 14, 2009

Hmm.  Looking at your code again I think you want to add an inlineGraphicStatusChanged event listener and recompose when the status changes.  I'm not sure that will work - it will take some investigation as to why the graphic doesn't appear the first time.

Hope that helps

Richard