EasyManua.ls Logo

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH - Page 434

MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
830 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
434 Working with Text and Strings
An example of using styles with XML
In this section, you 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 An example of
using styles with HTML” on page 431
To format XML with a style sheet:
1. In Flash, create a FLA file.
2. Using the Text tool, create a text field approximately 400 pixels wide and 300 pixels high.
3. Open the Property inspector (Window > Properties > Properties), and select the text field.
4. 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.
5. On Layer 1 in the Timeline (Window > Timeline), select the first frame.
6. To create the style sheet object, open the Actions panel (Window > Actions), and add the
following code to the Actions panel:
var styles:TextField.StyleSheet = new TextField.StyleSheet();
styles.setStyle("mainBody", {
color:'#000000',
fontFamily:'Arial,Helvetica,sans-serif',
fontSize:'12',
display:'block'
});
styles.setStyle("title", {
color:'#000000',
fontFamily:'Arial,Helvetica,sans-serif',
fontSize:'18',
display:'block',
fontWeight:'bold'
});
styles.setStyle("byline", {
color:'#666600',
fontWeight:'bold',
fontStyle:'italic',
display:'inline'
});
styles.setStyle("a:link", {
color:'#FF0000'
});
styles.setStyle("a:hover", {
textDecoration:'underline'
});

Table of Contents

Related product manuals