68
Chapter 3: Working with External Data
•
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 68
•
“Using HTTP to connect to server-side scripts” on page 69
•
“Using the LoadVars class” on page 69
•
“About XML” on page 70
•
“Using the XML class” on page 71
•
“Using the XMLSocket class” on page 71
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.
Before you can use loaded data in a SWF file, you must check to see if it has been loaded. For
example, you can’t load variables and manipulate their values in the same script because the data
to manipulate doesn’t exist in the file until it is loaded. In the following script, you cannot use the
variable
lastSiteVisited
until you’re sure that the variable has loaded from the
file
myData.txt
. In the file myData.txt, you would have text similar to the following example:
lastSiteVisited=www.macromedia.com
But if you used the following code, you could not trace the data that is loading:
loadVariables("myData.txt", 0);
trace(lastSiteVisited);
If you use the
XML.load()
,
XML.sendAndLoad()
, and
XMLSocket.connect()
methods, you
should define a handler that will process the data when it arrives. This handler is a property of an
XML or XMLSocket object to which you assign a function you defined. The handlers are called
automatically when the information is received. For the XML object, use
XML.onLoad()
or
XML.onData()
. For the XMLSocket object, use
XMLSocket.onConnect()
.
For more information, see
“Using the XML class” on page 71
and
“Using the XMLSocket class”
on page 71
. For information on how to load data in Flex applications, see also
Developing Flex
Applications
. For more information on using LoadVars to send and load data that can be processed
after the data is received, see
“Using the LoadVars class” on page 69
.
Содержание FLEX
Страница 1: ...Flex ActionScript Language Reference ...
Страница 8: ......
Страница 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0 ...
Страница 76: ......
Страница 133: ...break 133 See also for for in do while while switch case continue throw try catch finally ...
Страница 135: ...case 135 See also break default strict equality switch ...
Страница 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while ...
Страница 229: ...while 229 i 3 The following result is written to the log file 0 3 6 9 12 15 18 See also do while continue for for in ...
Страница 808: ...808 Chapter 7 ActionScript for Flash ...
Страница 810: ...810 Appendix A Deprecated Flash 4 operators ...
Страница 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code ...
Страница 816: ...816 Appendix B Keyboard Keys and Key Code Values ...
Страница 822: ...822 Index ...