An example of using styles with HTML
This section presents an example of using styles with HTML tags. You'll create a style sheet that
styles some built-in tags and defines some style classes. You'll then apply that style sheet to a
TextField object that contains HTML-formatted text.
To format HTML with a style sheet, do the following:
In your preferred text editor, create a file.
1
Add the following style sheet definition to the file:
2
p {
color: #000000;
font-family: Arial,Helvetica,sans-serif;
font-size: 12px;
display: inline;
}
a:link {
color: #FF0000;
}
a:hover{
text-decoration: underline;
}
.headline {
color: #000000;
font-family: Arial,Helvetica,sans-serif;
font-size: 18px;
font-weight: bold;
display: block;
}
.byline {
color: #666600;
font-style: italic;
font-weight: bold;
display: inline;
}
This style sheet defines styles for two built-in HTML tags (
all instances of those tags. It also defines two style classes (
be applied to specific paragraphs and text spans.
Save the file as html_styles.css.
3
In Flash, create a FLA file.
4
Using the Text tool, create a text field approximately 400 pixels wide and 300 pixels high.
5
Open the Property inspector (Window > Properties) and select the text field.
6
In the Property inspector, select Dynamic Text from the Text Type menu, select Multiline from
7
the Line Type menu, select the Render Text as HTML option, and type
Instance Name text box.
Select the first frame in Layer 1 in the Timeline (Window > Timeline).
8
144
Chapter 8: Working with Text
and
) that will be applied to
<p>
<a>
and
.headline
.byline
news_txt
) that will
in the
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?
Questions and answers