144
Chapter 8: Working with Text
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:
1
In your preferred text editor, create a file.
2
Add the following style sheet definition to the file:
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 (
<p>
and
<a>
) that will be applied to
all instances of those tags. It also defines two style classes (
.headline
and
.byline
) that will
be applied to specific paragraphs and text spans.
3
Save the file as html_styles.css.
4
In Flash, create a FLA file.
5
Using the Text tool, create a text field approximately 400 pixels wide and 300 pixels high.
6
Open the Property inspector (Window > Properties) and select the text field.
7
In the Property inspector, select Dynamic Text from the Text Type menu, select Multiline from
the Line Type menu, select the Render Text as HTML option, and type
news_txt
in the
Instance Name text box.
8
Select the first frame in Layer 1 in the Timeline (Window > Timeline).
Summary of Contents for FLASH MX 2004 - ACTIONSCRIPT
Page 1: ...ActionScript Reference Guide...
Page 8: ...8 Contents...
Page 12: ......
Page 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Page 54: ...54 Chapter 2 ActionScript Basics...
Page 80: ...80 Chapter 3 Writing and Debugging Scripts...
Page 82: ......
Page 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Page 112: ......
Page 120: ...120 Chapter 6 Using the Built In Classes...
Page 176: ......
Page 192: ...192 Chapter 10 Working with External Data...
Page 202: ...202 Chapter 11 Working with External Media...
Page 204: ......
Page 782: ...782 Chapter 12 ActionScript Dictionary...
Page 793: ...Other keys 793 221 222 Key Key code...
Page 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Page 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Page 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Page 816: ...816 Index...