Skip to main content
Known Participant
August 15, 2009
Question

Styling Text in Flex???

  • August 15, 2009
  • 1 reply
  • 693 views

Hey there,

What is your recommended way of styling text?  And how would you store user-defined styles and apply them to different parts of text (like "header1", "highlighted", etc.)?  Would you have to go through and use a text editor, or have you found a simple solution where you can just say “styleName” or “id” = “myStyle”, and it would apply styles from either a TextLayoutFormat object, or from some CSS parsed into a TextLayoutFormat object. Right now I am manually parsing CSS into TLF objects, caching them in a Dictionary, looping through Elements with “getChildByID”, and for-loop-assigning the TLF properties to the element. Seems like there could be something easier.

Thanks a lot,
Lance

This topic has been closed for replies.

1 reply

Adobe Employee
August 17, 2009

TextFlow supports the styleName and id properties IFormatResolver interface for this purpose.  Take a look at this blog entry.

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

It's not up-to-date with API revisions but all the constructs are still there.

The examples zip has a SImpleEditorWIthCSS example as well.  See:

http://download.macromedia.com/pub/opensource/tlf/textlayout_examples_072409.zip

Richard