Name

XMLSocket.onXML( ) Event Handler — defines the callback handler invoked when data is received by an XMLSocket object and has been parsed as XML

Availability

Flash 5

Synopsis

socket.onXML = xmlHandler
socket.xmlHandler(XMLobject  )

Arguments

XMLobject

The XML object that will house the incoming XML-formatted data.

Description

The onXML property allows you to specify a callback handler to be executed when Flash receives an incoming transmission. Whenever socket receives a complete block of data (i.e., a string followed by an ASCII null character) from the server, the callback handler specified by socket . onXML is automatically invoked. A server may send data as often as it pleases, but the callback handler is executed only when the trailing null character (i.e., a zero byte) is received by socket. In Java, a zero byte is specified as '\0'. When the zero byte is received, it causes ActionScript to parse any data that has been received by socket since the last zero byte was sent (or since the initial connection if this is the first zero byte). The parsed data is converted to an XML object hierarchy which is passed as the XMLobject argument to the callback handler.

If you are a Flash programmer who is responsible for the client side of a client/server application only, simply note that the callback handler specified by onXML receives any new XML data when it arrives. The new XML data is accessible through XMLobject.

To access the raw data sent over a socket, override the default behavior ...

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.