Friday, April 17, 2009

Styling text within Flex 3 TextArea using external CSS file

If you ever wondered how to use external style-sheets within a Flex 3 TextArea control to format text here's a nice solution.

example application

Embed your textfield styles in flex-applications css file
Application {
fontFamily: embeddedFont;
styleSheet: Embed(source="textFieldStyles.css", mimeType="application/octet-stream");
Create StyleSheet from style-definition and assign it and your data to the TextArea instance
private function applicationComplete():void {
textArea.styleSheet =
textArea.htmlText = data;


  1. Hey Joachim...
    thats interesting. Does this work only with flex or also with "normal" flahs as3? Do you have an example for the first part of code in as non-flex code?
    Thx. V.