Skip to main content
Inspiring
December 2, 2010
Answered

TLF Alternative (htmlText ?)

  • December 2, 2010
  • 1 reply
  • 1660 views

Greetings.

Is there any chance htmlText will be supported in Flex 4 and beyond (spark components).

TLF seems promising and very powerful, but seems to be overkill for some cases.

The simplicity of htmlText allowed for sharing the same content (ie stored in a databse) to a Flex and to an XHTML interface with CSS etc...

Granted it had it's issues thus the question ... is support for that approach dead?

Thank you all.

This topic has been closed for replies.
Correct answer rdermer

Thank you Richard.

Is TLF 2.0 in FLex Hero?


Sure is!

1 reply

Peter_deHaan
Participating Frequently
December 2, 2010

You can set rich text formatting by setting the textFlow property (or in some cases the content property in Flex, but textFlow should always work).

The "trick" to setting HTML text is that you may have to run it through a converter if you're using tags like <B> and <P>.

You can find a Flex example of setting HTML formatted text at http://blog.flexexamples.com/2009/10/06/displaying-html-formatted-text-in-a-spark-richtext-control-in-flex-4/. You can probably find a handful of other examples on the site if you search for "TextConverter".

Or you can do stuff like this:

<s:RichText>

    <s:textFlow>

        <s:TextFlow>

            <s:p>The quick brown <s:span fontWeight="bold">fox jumps over</s:span> the lazy dog.</s:p>

        </s:TextFlow>

    </s:textFlow>

</s:RichText>

Or:

<s:RichText>

    <s:content>

        <s:p>The quick brown <s:span fontWeight="bold">fox jumps over</s:span> the lazy dog.</s:p>

    </s:content>

</s:RichText>

Or:

<s:RichText>

    <s:p>The quick brown <s:span fontWeight="bold">fox jumps over</s:span> the lazy dog.</s:p>

</s:RichText>

Peter

Inspiring
December 2, 2010

Thank you for the reply Peter. Some additional questions for you about TLF.

1. You mention running the imported HTML through a converter. The HTML I'm working with consists only of tags that were supported by mx:TextArea's htmlText. Does such a converter exist or do I have to create it?

2. The HTML does not contain any formatting info. The way I did the formatting in mx:TextArea was to assign the styleSheet property to a styleSheet object. What is the equivalent process with TLF?

3. Links in the mx:TextArea could be made to trigger internal events in Flex  (<a href="event:blablabla">bla</a>). Is there such functionality built int to TLF and the new spark compoments?

4. Lastly, is the code available for a TLF editor? Or a downloadable application? Like the one on http://labs.adobe.com/technologies/textlayout/demos/. A standalone (AIR ?) version of this, could be very useful if I ended up having to create textFlow content.

Thank you for your time.

note: You guys are doing a great job, and the horizon looks very positive for Flex/Flash. Sometimes though, Adobe's decisions to change the way it does things cost paying customers ( early adopters ) a lot of grief. On top of buying new versions of the tools, we have to work to find information on how to use them.

How about including a copy of Training From the Source with the next release of Flash Builder?

Adobe Employee
December 3, 2010

Hi,

Some answers.

1.  Yes TextConverter.importToFlow using the TEXT_FIELD_HTML_FILTER is designed to import TextField htmlText

2. Connecting styleSheets will take some coding.  An approach is to use the formatResolver as described here:

http://blogs.adobe.com/tlf/2009/02/iformatresolver-and-using-css-1.html

3. Links triggering events are supported:

http://blogs.adobe.com/tlf/2010/12/tlf-flowelement-linkelement-events-and-eventmirrors.html

4. The latest code and examples including the source for the editor can be found as described here:

http://blogs.adobe.com/tlf/2010/11/tlf-1-1-and-2-0-textlayouteditor-demo-source.html

TLF 2.0 includes some improved support for TextField HTML text. FlowElement now has a new property "typeName." The TextFieldHTMLFilter sets typeName to the original type of the element.  So <foo>bar</foo> imports as a FlowElement with typeName set to foo.  This allows type selectors in the stylesheet to work.  Also several bugs in the filter were fixed.

Thanks for the encouragement.

Best Regards,

Richard