EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 140

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
140 Chapter 8: Working with Text
Supported CSS properties
Flash Player supports a subset of properties in the original CSS1 specification (www.w3.org/TR/
REC-CSS1). The following table shows the supported CSS properties and values, and their
corresponding ActionScript property names. (Each ActionScript property name is derived from
the corresponding CSS property name; the hyphen is omitted and the subsequent character
is capitalized.)
Creating a style sheet object
CSS style sheets are represented in ActionScript by the
TextField.StyleSheet class. This class
is only available for SWF files that target Flash Player 7 or later. To create a style sheet object, call
the TextField.StyleSheet classs constructor function.
var newStyle = 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” on page 141 and “Creating new
styles with ActionScript” on page 142.
CSS property ActionScript property Usage and supported values
text-align textAlign Recognized values are left, center, and right.
font-size fontSize Only the numeric part of the value is used; units (px, pt)
are not parsed; pixels and points are equivalent.
text-decoration textDecoration Recognized values are
none and underline.
margin-left marginLeft Only the numeric part of the value is used. Units (px, pt)
are not parsed; pixels and points are equivalent.
margin-right marginRight Only the numeric part of the value is used. Units (px, pt)
are not parsed; pixels and points are equivalent.
font-weight fontWeight Recognized values are
normal and bold.
font-style fontStyle Recognized values are
normal and italic.
text-indent textIndent Only the numeric part of the value is used. Units (px, pt)
are not parsed; pixels and points are equivalent.
font-family fontFamily 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 will be converted
to an appropriate device font. The following font
conversions are available:
mono is converted to
_typewriter, sans-serif is converted to _sans, and
serif is converted to _serif.
color color Only hexadecimal color values are supported. Named
colors (like
blue) are not supported.
display display Supported values are
inline, block, and none.

Table of Contents

Related product manuals