How to use markup tag <img> in TextFlow object in Flex

763 Views Asked by At

In the .mxml file, we can easy create the RichEditableText (RET) component with content of image in it:

<s:RichEditableText id="ret" height="600" width="900" selectable="false" editable="false" click="onClick(event)">
    <s:content>
        <s:div>
            <s:p>
                <s:span>
                    This is a
                </s:span>
                <s:img source="@Embed('image.png')" />
                <s:span>
                    span test!
                </s:span>
            </s:p>
        </s:div>            
    </s:content>
</s:RichEditableText>

But if I want to create content of RET dynamically, such as

richEditableText.textFlow = TextConverter.importToFlow(textFlowStr, TextConverter.TEXT_FIELD_HTML_FORMAT);
richEditableText.textFlow = TextFlowUtil.importFromString(textFlowStr);
richEditableText.textFlow = TextConverter.importToFlow(textFlowStr, TextConverter.TEXT_LAYOUT_FORMAT)

It always give the exception. My textFlowStr is like this:

<img src="image.png" />  **for html format**
<img source="image.png" /> **for Text Layout Format**

In this How to add dynamically text and tags inside textFlow, it gives a example, but I try <img> it does not work.

This link says it support <img> tag. But I do not know how to use it?

0

There are 0 best solutions below