Skip to main content
Participant
Jun 23, 2009 11:26 AM UTC
Answered

adding DisplayObject using xmlText property

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 is closed to new replies. Start a new post to keep the conversation going.
rdermerCorrect answer
Inspiring
Jun 23, 2009 5:37 PM UTC

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 replies

Inspiring
Jun 23, 2009 4:35 PM UTC

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

Translate
RGulievAuthor
Participant
Jun 23, 2009 4:41 PM UTC

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

Translate
rdermerCorrect answer
Inspiring
Jun 23, 2009 5:37 PM UTC

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

Translate