Example
In the following example, the
from the server. The zero (0) byte terminator is not included in the string.
XMLSocket.prototype.onData = function (src) {
this.onXML(new XML(src));
}
XMLSocket.onXML
Availability
Flash Media Server 2.
Usage
myXMLSocket.onXML = function(object) {}
Parameters
An XML object that contains a parsed XML document received from a server.
object
Returns
Nothing.
Description
Event handler; invoked by Flash Media Server when the specified XML object containing an
XML document arrives through an open XMLSocket connection. An XMLSocket
connection can be used to transfer an unlimited number of XML documents between the
client and the server. Each document is terminated with a zero (0) byte. When Flash Media
Server receives the zero byte, it parses all the XML received since the previous zero 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
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
simple chat application. The function
single XML element,
<MESSAGE USER="John" TEXT="Hello, my name is John!" />.
var socket = new XMLSocket();
parameter is a string containing XML text downloaded
src
myOnXML
, in the following format:
MESSAGE
event.
onXML
onXML
instructs the chat application to recognize a
method in a
XMLSocket class
225
Need help?
Do you have a question about the FLASH MEDIA SERVER 2-SERVER-SIDE ACTIONSCRIPT LANGUAGE and is the answer not in the manual?