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

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

Advertisement

styles.load(css_url);
styles.onLoad = function(ok) {
if (ok) {
// If the style sheet loaded without error,
// then assign it to the text object,
// and assign the HTML text to the text field.
news_txt.styleSheet = styles;
news_txt.text = storyText;
}
};
Note: In this ActionScript, you are loading the text from an external file. For information on loading
external data, see
Save the file as news_html.fla in the same directory that contains the CSS file you created in step
11.
3.
Select Control > Test Movie to see the styles applied to the HTML text automatically.
12.
Using styles to define new tags
If you define a new style in a style sheet, that style can be used as a tag, in the same way as you
would use a built-in HTML tag. For example, if a style sheet defines a CSS style named
sectionHeading
the style sheet. This feature lets you assign arbitrary XML-formatted text directly to a text field, so
that the text is automatically formatted using the rules in the style sheet.
For example, the following style sheet creates the new styles
and
emphasized
.sectionHeading {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 18px;
display: block
}
.mainBody {
color: #000099;
text-decoration: underline;
font-size: 12px;
display: block
}
.emphasized {
font-weight: bold;
display: inline
}
You could then populate a text field associated with that style sheet with the following XML-
formatted text:
<sectionHeading>This is a section</sectionHeading>
<mainBody>This is some main body text,
with one <emphasized>emphatic</emphasized> word.
</mainBody>
234
Chapter 9: Working with Text
Chapter 12, "Working with External Media," on page
, you can use
<sectionHeading>
:
295.
as an element in any text field associated with
sectionHeading
,
,
mainBody

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

This manual is also suitable for:

Flash mx 2004 - actionscript

Table of Contents