CSS property ActionScript
property
font-family
fontFamily
color
color
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
new styles with ActionScript" on page
You can find a sample source file, formattedText.fla, in the Samples folder on your hard disk,
which shows you how to apply CSS formatting to text that you load into a SWF file
at runtime.
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\LoadText.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash 8/Samples and
Tutorials/Samples/ActionScript/LoadText.
Loading external CSS files
You can define styles in an external CSS file and then load that file into a style sheet object.
The styles defined in the CSS file are added to the style sheet object. To load an external CSS
file, you use the
load()
file has finished loading, use the style sheet object's
424
Working with Text and Strings
Usage and supported values
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:
mono
converted to
_serif
Only hexadecimal color values are supported.
Named colors (such as
Colors are written in the following format:
#FF0000
"Loading external CSS files" on page 424
426.
method of the TextField.StyleSheet class. To determine when the CSS
is converted to
_typewriter
, and
_sans
serif
.
blue
.
event handler.
onLoad
,
is
sans-serif
is converted to
) are not supported.
and
"Creating
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?
Questions and answers