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.
Create a new text file in a text or XML editor, and save the document as myText.txt. Add the
4.
following text to the file:
<p class='headline'>Flash Player now supports Cascading StyleSheets!</
p><p><span class='byline'>San Francisco, CA</span>--Macromedia Inc.
announced today a new version of Flash Player that supports Cascading
Style Sheet (CSS) text styles. For more information, visit the <a
href='http://www.macromedia.com'>Macromedia Flash web site.</a></p>
Note: If you copy and paste this text string, make sure that you remove any line breaks that might
have been added to the text file.
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
8.
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).
9.
Open the Actions panel (Window > Development Panels > Actions), and add the following
10.
code to the Actions panel:
// Create a new style sheet and LoadVars object
var myVars:LoadVars = new LoadVars();
var styles = new TextField.StyleSheet();
// Location of CSS and text files to load
var txt_url = "myText.txt";
var css_url = "html_styles.css";
// Load text to display and define onLoad handler
myVars.load(txt_url);
myVars.onData = function(content) {
storyText = content;
};
// Load CSS file and define onLoad handler:
and
<p>
<a>
.headline
Formatting text with Cascading Style Sheets
) that will be applied to
and
) that will
.byline
in the
news_txt
233
Need help?
Do you have a question about the FLASH MX 2004-USING ACTIONSCRIPT IN FLASH and is the answer not in the manual?
Questions and answers