392
Working with Text and Strings
■
On the Macintosh, browse to
Macintosh HD
/Applications/Macromedia Flash 8/Samples
and Tutorials/Samples/ActionScript/TextFields.
About loading text and variables into
text fields
You can load text into a Flash document several ways, including (but certainly not limited to)
using FlashVars, LoadVars, XML, or web services. Perhaps the simplest method of passing text
into a Flash document is to use the FlashVars property, which passes short strings of text into
a Flash document through the
object
and
embed
tags in the HTML code that you use to
embed the SWF file in an HTML page. Another easy way to load text or variables into a Flash
document is to use the LoadVars class, which can load large blocks of text or load a series of
URL encoded variables from a text file.
As you can see from the previous examples in this section, some ways of loading text into a
SWF file are easier than others. However, if you syndicate data from external sites, you might
not have a choice for the format of the data that you need to load.
Each way of loading and/or sending data to and from a SWF file has its pros and cons. XML,
web services, and Flash Remoting are the most versatile for loading external data, but they are
also the most difficult to learn. For information on Flash Remoting, see
www.macromedia.com/support/flashremoting
.
FlashVars and LoadVars are much simpler, as demonstrated in
“Using FlashVars to load and
display text” on page 393
and
“Using LoadVars to load and display text” on page 394
, but
they can be much more limited in the types and formats of data that you can load. Also, you
must follow security restrictions when you send and load data. For information on security,
see
Chapter 17, “Understanding Security.”
For more information on loading external data, see
Chapter 16, “Working with External Data.”
The following sections show you different ways to load text and variables into your
documents:
■
“Using FlashVars to load and display text” on page 393
■
“Using LoadVars to load and display text” on page 394
■
“Loading variables by using LoadVars” on page 396
■
“Loading and displaying text from an XML document” on page 397
Содержание 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...