MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 426

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

As with all other ActionScript methods that load data over the network, the CSS file must
reside in the same domain as the SWF file that is loading the file. (See
subdomain access between SWF files" on page
with Flash, see StyleSheet (TextField.StyleSheet) in the ActionScript 2.0 Language
Reference.
You can find a sample source file, formattedText.fla, in the Samples folder on your hard disk,
which shows you how to apply CSS formatting to text that you load into a SWF file
at runtime.
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\LoadText.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash 8/Samples and
Tutorials/Samples/ActionScript/LoadText.
Creating new styles with ActionScript
You can create new text styles with ActionScript by using the
TextField.StyleSheet class. This method takes two parameters: the name of the style and an
object that defines that style's properties.
For example, the following code creates a style sheet object named
styles that are identical to the ones you already imported (see
on page
424):
var styles:TextField.StyleSheet = new TextField.StyleSheet();
styles.setStyle("bodyText",
{fontFamily: 'Arial,Helvetica,sans-serif',
fontSize: '12px'}
);
styles.setStyle("headline",
{fontFamily: 'Arial,Helvetica,sans-serif',
fontSize: '24px'}
);
426
Working with Text and Strings
696.) For more information on using CSS
setStyle()
styles
"Loading external CSS files"
"Cross-domain and
method of the
that defines two

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

This manual is also suitable for:

Flash 8

Table of Contents