Share this Page URL
Help

Chapter 5. Working with Text > Using Cascading Style Sheets with HTML Text - Pg. 226

Working with Text 226 Using Cascading Style Sheets with HTML Text Cascading Style Sheets (CSS) contain sets of formatting rules for HTML and XML text. CSS allow you to define certain text attributes and give them a style name. This style name, called a selector, can be applied to any implemented text. Each time you need to implement the defined style, you can refer back to the CSS. Load an external CSS In any text or HTML editor, place the following code: // External CSS File: styles.css headline { font-family: Arial, Helvetica, sans-serif; font-size: 12 px; } bodyText { font-family: Arial, Helvetica, sans-serif; font-size: 10 px; } This code is typically found in a CSS. This example defines two styles, one for a sans-serif headline at 12 pixels, the other a sans-serif body text at 10 pixels. Select the first frame of your Flash movie. Place the following code in the Actions panel: var css_styles = new TextField.StyleSheet(); css_styles.load("styles.css"); css_styles.onLoad = function(ok) { if(ok) {