Skip to main content
Participant
June 23, 2009
Answered

adding DisplayObject using xmlText property

  • June 23, 2009
  • 1 reply
  • 1054 views

So, is it possible to add DisplayObject using xmlText property? Something like that:

this._textLayout.xmlText = "<flow:TextFlow><flow:p><flow:img width="auto" height="auto" source="new Bitmap(new BitmapData(100, 100))" /></flow:p></flow:TextFlow>";

Or I should parse string and replace <flow:img/> by ParagraphElement.addChildAt(0, InlineGraphicElement) ?

Sorry for bad english.

This topic has been closed for replies.
Correct answer rdermer

You need a more recent build - this was added fairly recently.  I recall the function was spelled getElementById for a while until it was corrected.

Hope that helps,

Richard

1 reply

Adobe Employee
June 23, 2009

Hi,

source as ActionScript definitely won't work.  Adding the ILG at runtime will.

Creating the ILG in markup and then finding it and modifying it will work.  For example,

this._textLayout.xmlText = "<flow:TextFlow><flow:p><flow:img width="auto" height="auto" id="xyzzy"/></flow:p></flow:TextFlow>";

textFlow.getElementByID("xyzzy").source = new Bitmap(new BitmapData(100, 100));

textFlow.flowComposer.updateAllContainers();

Each ILG will need a unique id.

Best Regards,

Richard

RGulievAuthor
Participant
June 23, 2009

Sorry, but I can't find getElementByID method in TextFlow class.

rdermerCorrect answer
Adobe Employee
June 23, 2009

You need a more recent build - this was added fairly recently.  I recall the function was spelled getElementById for a while until it was corrected.

Hope that helps,

Richard