26 July 2011
Text Layout Framework (TLF) text fields do not support cascading style sheets (CSS) by default but can support CSS formatting using a custom-built format resolver class. A format resolver is a style parser that you can assign to a TLF text field to support CSS or similar "based-on" styling formats. Once a format resolver is applied to a TLF text field, you can use CSS to format the text field in much the same way you would a Classic text field. Additionally, you can use CSS to format any TLF markup text supplied to a TLF text field.
This sample contains two parts, each showing how to implement a format resolver to recreate the Classic text sample with a TLF text field. The first part demonstrates how to use an external CSS file to format HTML text applied to a TLF text field:
The second part demonstrates how to accomplish the same task using TLF markup instead of HTML text:
Take a look at helloworld.css file, the helloworld.xml file, the CSSFormatResolver class, as well as the ActionScript code to see how everything fits together.
tlfMarkupproperty to assign markup to a TLF text field, be sure to assign the markup as a String instead of XML to avoid applying unintended formatting to the field.
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.