MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Manuale Utente Pagina 154

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 155
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 153
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
151
Parameters
object An XML object that contains a parsed XML document received from a server.
Example
The following function overrides the default implementation of the
onXML() method in a simple chat application.
The
myOnXML() function instructs the chat application to recognize a single XML element, MESSAGE, in the following
format:
<MESSAGE USER="John" TEXT="Hello, my name is John!" />.
var socket = new XMLSocket();
The following displayMessage() function is assumed to be a user-defined function that shows the message that
the user receives:
socket.onXML = function (doc) {
var e = doc.firstChild;
if (e != null && e.nodeName == "MESSAGE") {
displayMessage(e.attributes.user, e.attributes.text);
}
};
XMLSocket.send()
myXMLSocket.send(object)
Converts the XML object or data specified in the object parameter to a string and transmits it to the server, followed
by a zero (0) byte. If
object is an XML object, the string is the XML textual representation of the XML object.
If the
myXMLSocket object is not connected to the server (by using XMLSocket.connect()), the
XMLSocket.send() operation fails.
Availability
Flash Media Server 2
Parameters
object An XML object or other data to transmit to the server.
Returns
A boolean value;
true if the server is able to get the socket and the socket state is connected; otherwise, false. A
true value does not mean that the data has been transmitted successfully. The send() method is asynchronous; it
returns a value immediately, but the data may be transmitted later.
Example
The following example shows how you can specify a user name and password to send the XML object
my_xml to the
server:
var myXMLSocket = new XMLSocket();
var my_xml = new XML();
var myLogin = my_xml.createElement("login");
myLogin.attributes.username = usernameTextField;
myLogin.attributes.password = passwordTextField;
my_xml.appendChild(myLogin);
myXMLSocket.send(my_xml);
See also
XMLSocket.connect()
Vedere la pagina 153
1 2 ... 149 150 151 152 153 154 155

Commenti su questo manuale

Nessun commento