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;
NO
TE
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.
Содержание FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Страница 1: ...Learning ActionScript 2 0 in Flash...
Страница 8: ...8 Contents...
Страница 18: ...18 Introduction...
Страница 30: ...30 What s New in Flash 8 ActionScript...
Страница 66: ...66 Writing and Editing ActionScript 2 0...
Страница 328: ...328 Interfaces...
Страница 350: ...350 Handling Events...
Страница 590: ...590 Creating Interaction with ActionScript...
Страница 710: ...710 Understanding Security...
Страница 730: ...730 Debugging Applications...
Страница 780: ...780 Deprecated Flash 4 operators...
Страница 830: ...830 Index...