70
Chapter 3: Working with External Data
The LoadVars class was introduced in Flash Player 6 to provide a cleaner, more object-oriented
interface for the common task of exchanging CGI data with a web server. Advantages of the
LoadVars class include the following:
•
You don’t need to create container movie clips for holding data or clutter existing movie clips
with variables specific to client/server communication.
•
The class interface is similar to the XML object, which provides some consistency in
ActionScript. It uses the methods
load()
,
send()
, and
sendAndLoad()
to initiate
communication with a server. The main difference between the LoadVars and XML classes is
that the LoadVars data is a property of the LoadVars object, rather than an XML Document
Object Model (DOM) tree stored in the XML object.
•
The class interface is more straightforward—with methods named
load
,
send
,
sendAndLoad
—than the older loadVariables interface.
•
You can get additional information about the communication, using the
getBytesLoaded
and
getBytesTotal
methods
•
You can get progress information about the download of your data (although you can’t access
the data until it is fully downloaded).
•
The callback interface is through ActionScript methods (
onLoad
) instead of the obsolete,
deprecated
onClipEvent
(data) approach required for loadVariables.
•
There are error notifications.
•
You can add custom HTTP request headers.
You must create a LoadVars object to call its methods. This object is a container to hold the
loaded data.
For more information, see the
LoadVars class
entry.
About XML
Extensible Markup Language (XML
) is becoming the standard for exchanging structured data in
Internet applications. You can integrate data in Flash with servers that use XML technology to
build sophisticated applications, such as chat or brokerage systems.
In XML, as with HTML, you use tags to specify, or
mark up
, a body of text. In HTML, you use
predefined tags to indicate how text should appear in a web browser (for example, the
<b>
tag
indicates that text should be bold). In XML, you define tags that identify the type of a piece of
data (for example,
<password>VerySecret</password>
). XML separates the structure of the
information from the way it appears, so the same XML document can be used and reused in
different environments.
Every XML tag is called a
node
, or an element. Each node has a type (1, which indicates an XML
element, or 3, which indicates a text node), and elements might also have attributes. A node
nested in a node is called a
child node
. This hierarchical tree structure of nodes is called the XML
DOM—much like the JavaScript DOM, which is the structure of elements in a web browser.
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...