About loading text and variables into text fields
393
You can find sample source files that demonstrate how to work with text fields using
ActionScript. The source files are called loadText.fla and formattedText.fla, and you can find
them in the Samples folder on your hard disk:
■
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.
You can also find a source file that loads text and applies anti-alias formatting in addition to
bitmap caching. The sample source file is called flashtype.fla in the Samples folder on your
hard disk:
■
In Windows, browse to
boot drive
\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\FlashType.
■
On the Macintosh, browse to
Macintosh HD
/Applications/Macromedia Flash 8/Samples
and Tutorials/Samples/ActionScript/FlashType.
Using FlashVars to load and display text
Using FlashVars is simple, but requires you to publish your SWF files along with HTML
documents. You modify the generated HTML code and include the FlashVars properties in
both the
object
and
embed
tags. You can then test the Flash document by viewing the
modified HTML document in your web browser.
To use FlashVars to pass variables from HTML to your Flash document:
1.
Create a new Flash document and save it as
flashvars.fla
.
2.
Add the following ActionScript to Frame 1 of the Timeline:
this.createTextField("my_txt", 10, 10, 10, 100, 21);
my_txt.text = _level0.username;
3.
Save the Flash document and select File > Publish to generate the HTML and SWF files.
4.
Open up the flashvars.html document in a text or HTML editor.
NO
TE
An HTML document publishes, by default, to the same directory as your FLA file. If
an HTML document does not publish, select File > Publish Settings and then select
the Formats tab. Make sure that you select HTML.
Содержание 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...