EasyManua.ls Logo

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

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...
432 Working with Text and Strings
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>
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;
NOTE
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.

Table of Contents

Related product manuals