780
Chapter 12: ActionScript Dictionary
Description
Event handler; invoked when a message has been downloaded from the server, terminated by a
zero byte. You can override
XMLSocket.onData
to intercept the data sent by the server without
parsing it as XML. This is a useful if you’re transmitting arbitrarily formatted data packets, and
you’d prefer to manipulate the data directly when it arrives, rather than have Flash Player parse the
data as XML.
By default, the
XMLSocket.onData
method invokes the
XMLSocket.onXML
method. If you
override
XMLSocket.onData
with your own behavior,
XMLSocket.onXML
will no longer be called
unless you call it in your implementation of
XMLSocket.onData
.
XMLSocket.prototype.onData = function (src) {
this.onXML(new XML(src));
}
In the above example, the
src
parameter is a string containing XML text downloaded from the
server. The zero byte terminator is not included in the string.
XMLSocket.onXML()
Availability
Flash Player 5.
Usage
myXMLSocket
.onXML(
object
) = function() {
// your statements here
}
Parameter
object
An XML object that contains a parsed XML document received from a server.
Returns
Nothing.
Description
Event handler; invoked by Flash Player when the specified XML object containing an XML
document arrives over an open XMLSocket connection. An XMLSocket connection may be used
to transfer an unlimited number of XML documents between the client and the server. Each
document is terminated with a 0 (zero) byte. When Flash Player receives the 0 byte, it parses all of
the XML received since the previous 0 byte, or since the connection was established if this is the
first message received. Each batch of parsed XML is treated as a single XML document and passed
to the
onXML
method.
The default implementation of this method performs no actions. To override the default
implementation, you must assign a function containing actions that you define.
Example
The following function overrides the default implementation of the
onXML
method in a simple
chat application. The function
myOnXML
instructs the chat application to recognize a single XML
element,
MESSAGE
, in the following format.
<MESSAGE USER="John" TEXT="Hello, my name is John!" />.
Содержание FLASH MX 2004 - ACTIONSCRIPT
Страница 1: ...ActionScript Reference Guide...
Страница 8: ...8 Contents...
Страница 12: ......
Страница 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Страница 54: ...54 Chapter 2 ActionScript Basics...
Страница 80: ...80 Chapter 3 Writing and Debugging Scripts...
Страница 82: ......
Страница 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Страница 112: ......
Страница 120: ...120 Chapter 6 Using the Built In Classes...
Страница 176: ......
Страница 192: ...192 Chapter 10 Working with External Data...
Страница 202: ...202 Chapter 11 Working with External Media...
Страница 204: ......
Страница 782: ...782 Chapter 12 ActionScript Dictionary...
Страница 793: ...Other keys 793 221 222 Key Key code...
Страница 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Страница 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Страница 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Страница 816: ...816 Index...