Skip to main content
Participant
June 23, 2009
Besvarat

adding DisplayObject using xmlText property

  • June 23, 2009
  • 4 svar
  • 1057 visningar

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.

Det här ämnet har stängts för svar.
Bästa svar av 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

4 svar

Inspiring
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

RGulievSkribent
Participant
June 23, 2009

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

Inspiring
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