Search code examples
htmlapache-flexactionscriptentitiestlf

HTML entities in TextFlow


How can HTML entities be made to work with TextFlow (specifically TEXT_LAYOUT_FORMAT)?

Example: ' is not converted into a single quote.

Any help would be appreciated.


Solution

  • Do you mean this?

    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx"
                   minWidth="955"
                   minHeight="600">
    
        <fx:Script>
            <![CDATA[
                import flashx.textLayout.conversion.TextConverter;
                import flashx.textLayout.elements.TextFlow;
    
                private const text:String = "&lt; &gt; &quot; &apos;";
            ]]>
        </fx:Script>
    
        <s:RichEditableText editable="false"
                            selectable="true"
                            textFlow="{TextConverter.importToFlow(text, TextConverter.TEXT_FIELD_HTML_FORMAT)}"
                            buttonMode="true"
                            width="100%"
                            height="100%" />
    
    </s:Application>