634
Working with External Data
Sending and loading variables
A SWF file is a window for capturing and displaying information, much like an HTML page.
However, SWF files can stay loaded in the browser and continuously update with new
information without having to reload the entire page. Using ActionScript functions and
methods, you can send information to and receive information from server-side scripts and
receive information from text files and XML files.
In addition, server-side scripts can request specific information from a database and relay it to
a SWF file. Server-side scripts can be written in different languages: some of the most
common are CFML, Perl, ASP (Microsoft Active Server Pages), and PHP. By storing
information in a database and retrieving it, you can create dynamic and personalized content
for your SWF file. For example, you could create a message board, personal profiles for users,
or a shopping cart that keeps track of a user’s purchases.
Several ActionScript functions and methods let you pass information into and out of a SWF
file. Each function or method uses a protocol to transfer information and requires
information to be formatted in a certain way.
■
The functions and MovieClip methods that use the HTTP or HTTPS protocol to send
information in URL-encoded format are
getURL()
,
loadVariables()
,
loadVariablesNum()
,
loadMovie()
, and
loadMovieNum()
.
■
The LoadVars methods that use the HTTP or HTTPS protocol to send and load
information in URL-encoded format are
load()
,
send()
, and
sendAndLoad()
.
■
The methods that use HTTP or HTTPS protocol to send and load information as XML
are
XML.send()
,
XML.load()
, and
XML.sendAndLoad()
.
■
The methods that create and use a TCP/IP socket connection to send and load
information as XML are
XMLSocket.connect()
and
XMLSocket.send()
.
For more information, see the following topics:
■
“Checking for loaded data” on page 634
■
“Creating a progress bar to display data loading progress” on page 636
Checking for loaded data
Each function or method that loads data into a SWF file (except
XMLSocket.send()
) is
asynchronous
: the results of the action are returned at an indeterminate time.
Содержание 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...