MACROMEDIA FLASH MX 2004-USING ACTIONSCRIPT IN FLASH Use Manual page 235

Using actionscript in flash
Hide thumbs Also See for FLASH MX 2004-USING ACTIONSCRIPT IN FLASH:
Table of Contents

Advertisement

An example of using styles with XML
In this section, you can create a FLA file that has XML-formatted text. You'll create a style sheet
using ActionScript, rather than importing styles from a CSS file as shown in
styles with HTML" on page 232
To format XML with a style sheet:
In Flash, create a FLA file.
1.
Using the Text tool, create a text field approximately 400 pixels wide and 300 pixels high.
2.
Open the Property inspector (Window > Properties), and select the text field.
3.
In the Property inspector, select Dynamic Text from the Text Type menu, select Multiline from
4.
the Line Type menu, select the Render Text as HTML option, and type
Instance Name text box.
On Layer 1 in the Timeline (Window > Timeline), select the first frame.
5.
To create the style sheet object, open the Actions panel (Window > Development Panels >
6.
Actions), and add the following code to the Actions panel:
var xmlStyles = new TextField.StyleSheet();
xmlStyles.setStyle("mainBody", {
color:'#000000',
fontFamily:'Arial,Helvetica,sans-serif',
fontSize:'12',
display:'block'
});
xmlStyles.setStyle("title", {
color:'#000000',
fontFamily:'Arial,Helvetica,sans-serif',
fontSize:'18',
display:'block',
fontWeight:'bold'
});
xmlStyles.setStyle("byline", {
color:'#666600',
fontWeight:'bold',
fontStyle:'italic',
display:'inline'
});
xmlStyles.setStyle("a:link", {
color:'#FF0000'
});
xmlStyles.setStyle("a:hover", {
textDecoration:'underline'
});
This code creates a new style sheet object named
method. The styles exactly match the ones you created in an external CSS file
setStyle()
earlier in this chapter.
that defines styles by using the
xmlStyles
Formatting text with Cascading Style Sheets
"An example of using
in the
news_txt
235

Advertisement

Table of Contents
loading
Need help?

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

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents