The StyleSheet class lets you create a StyleSheet object that contains text formatting rules for font size, color, and other styles. You can then apply styles defined by a style sheet to a TextField object that contains HTML- or XML-formatted text. The text in the TextField object is automatically formatted according to the tag styles defined by the StyleSheet object. You can use text styles to define new formatting tags, redefine built-in HTML tags, or create style classes that you can apply to certain HTML tags.
To apply styles to a TextField object, assign the StyleSheet object to a TextField object's styleSheet
property.
Flash Player supports a subset of properties in the original CSS1 specification (www.w3.org/TR/REC-CSS1). The following table shows the supported Cascading Style Sheet (CSS) properties and values, as well as their corresponding ActionScript property names. (Each ActionScript property name is derived from the corresponding CSS property name; if the name contains a hyphen, the hyphen is omitted and the subsequent character is capitalized.)
CSS property | ActionScript property | Usage and supported values |
---|---|---|
|
| Only hexadecimal color values are supported. Named colors (such as |
|
| Supported values are |
|
| A comma-separated list of fonts to use, in descending order of desirability. Any font family name can be used. If you specify a generic font name, it is converted to an appropriate device font. The following font conversions are available: |
|
| Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points are equivalent. |
|
| Recognized values are |
|
| Recognized values are |
|
| Recognized values are |
|
| The amount of space that is uniformly distributed between characters. The value specifies the number of pixels that are added to the advance after each character. A negative value condenses the space between characters. Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points are equivalent. |
|
| Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points are equivalent. |
|
| Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points are equivalent. |
|
| Recognized values are |
|
| Recognized values are |
|
| Only the numeric part of the value is used. Units (px, pt) are not parsed; pixels and points are equivalent. |