Chapter 7. Text and TextFlows

The text components in Flex 4 have been updated to take advantage of the new text-rendering engine in Flash Player 10, referred to as the Flash Text Engine. To work with text in a Flex application, you’ll want to use the new components that utilize the Text Layout Framework: TextArea, RichText, and RichEditableText. Each of these components provides different functionality in a Flex application. The Label component provides simple, lightweight, basic text functionality. Label supports all of the properties of the GraphicElement, as well as bidirectional text and a limited subset of text formatting, but it doesn’t support hypertext or inline graphics. The RichText control supports HTML and, unlike Label, uses the TextFlow object model. It supports multiple formats and paragraphs but not scrolling, selection, or editing. Lastly, RichEditableText supports scrolling, selection, editing, and hyperlinks, as well as supporting all the functionality of the Label and RichText components. Label does not use the Text Layout Framework, relying solely on the Flash Text Engine, while the other two components leverage the Text Layout Framework built into Flex 4.

The Text Layout Framework also introduces the TextFlow class, which is an XML document of FlowElements that can be written using tags or using FlowElement classes. For instance, a paragraph within a TextFlow can be created using a <p> tag in a TextFlow XML document or by attaching a ParagraphElement directly ...

Get Flex 4 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.