Formatting with HTML and CSS

When you're working in ActionScript, there's more than one way to format text. The previous technique using ActionScript's TextFormat object works well when you're working on a project on your own. The properties and methods are familiar if you're used to working with Flash's Properties panel. Flash also lets you use the same formatting tools used by web designers: HTML (hypertext markup language) and CSS (Cascading Style Sheets). There are a few reasons why you might want to go this route for a project. Perhaps your project uses lots of text and it's already formatted using HTML. In some cases, you may be working on a large project where some people are responsible for generating the text and others are responsible for presenting it on the Web or in a Flash-based program.

HTML and CSS Philosophical Differences

Before you make a decision about using either HTML or CSS for your Flash formatting chores, it helps to understand their approaches to formatting text. HTML embeds formatting codes inside the text. For example, the second line in the tlfBanner text field of the previous example might look like this if you formatted in HTML:

<font face="Cooper Black" size="3"> Home of the <i>legendary</i> <b>Stutz
Bearcat</b></font>

When a web browser like Internet Explorer, Safari, or Chrome reads this text, it knows how to display the text in the browser window. It applies the formatting instructions and shows the text. It displays the proper typeface if it's available, ...

Get Flash CS5: The Missing Manual 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.