26 July 2011
Cascading style sheets (CSS) and HTML-formatted text can be used to format Classic text fields. For example, you can create a text string formatted with HTML tags (<body>,<p>,<div>,<span>,<a>, etc.) and then assign styles to each of the HTML tags in use. The result is a fully styled Flash text field where you can adjust the text formatting from an external CSS file.
This sample demonstrates how to use an external CSS file to format HTML text applied to a Classic text field. Look at helloworld.css as well as the ActionScript code to see how everything fits together.
Tip: Be sure to embed all the fonts defined in your style sheet so that you can see the formatting work as expected. For example, if you'd like to be able to use any combination of Arial regular, bold, and italic, you need to embed Arial regular, Arial bold, Arial italic, and Arial bold italic in the FLA file.
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.
More Like This