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

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

4.
Create a new text file in a text or HTML editor, and save the document as myText.htm.
Add the following text to the file:
<p class='headline'>Flash adds FlashType rendering technology!</
p><p><span class='byline'>San Francisco, CA</span>--Macromedia Inc.
announced today a new version of Flash that features a brand new font
rendering technology called FlashType, most excellent at rendering
small text with incredible clarity and consistency across platforms.
For more information, visit the <a href='http://
www.macromedia.com'>Macromedia Flash web site.</a></p>
If you copy and paste this text string, make sure that you remove any line breaks that
might have been added to the text string.
5.
Create a new Flash document in the Flash authoring tool.
6.
Select the first frame in Layer 1 in the Timeline (Window > Timeline).
7.
Open the Actions panel (Window > Actions), and add the following code to the
Actions panel:
this.createTextField("news_txt", 99, 50, 50, 450, 300);
news_txt.border = true;
news_txt.html = true;
news_txt.multiline = true;
news_txt.wordWrap = true;
// Create a new style sheet and LoadVars object.
var myVars_lv:LoadVars = new LoadVars();
var styles:TextField.StyleSheet = new TextField.StyleSheet();
// Location of CSS and text files to load.
var txt_url:String = "myText.htm";
var css_url:String = "html_styles.css";
// Define onData handler and load text to display.
myVars_lv.onData = function(src:String):Void {
if (src != undefined) {
news_txt.htmlText = src;
} else {
trace("Unable to load HTML file");
}
};
myVars_lv.load(txt_url);
// Define onLoad handler and Load CSS file.
styles.onLoad = function(success:Boolean):Void {
if (success) {
/* 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;
432
Working with Text and Strings

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