Creating a style sheet object

CSSs are represented in ActionScript by the TextField.StyleSheet class. This class is available only for SWF files that target Flash Player 7 or later. To create a style sheet object, call the constructor function of the TextField.StyleSheet class:

var newStyle:TextField.StyleSheet = new TextField.StyleSheet();

To add styles to a style sheet object, you can either load an external CSS file into the object or define the styles in ActionScript. See Loading external CSS files and Creating new styles with ActionScript.

For a sample source file, formattedText.fla, which shows you how to apply CSS formatting to text that you load into a SWF file at runtime, see the Flash Sample page at www.adobe.com/go/learn_fl_samples. Download and decompress the Samples zip file and navigate to the ActionScript2.0/LoadText folder to access the sample.


Flash CS3


 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00000909.html