
XMLSocket Class
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
950
|
ActionScript Language Reference
Example
The following code adds a custom secondChild() method to XMLNode.prototype (the
secondChild() method is subsequently available from any XML node in our movie):
XMLNode.prototype.secondChild = function () {
return this.childNodes[1];
};
myDoc = new XML("<PRODUCT>Cell Phone</PRODUCT><PRODUCT>Game Console</PRODUCT>");
trace(myDoc.secondChild()); // Displays: "<PRODUCT>Game Console</PRODUCT>"
It’s also perfectly legitimate to augment the XML class via XML.prototype, but such addi-
tions apply only to main container nodes (direct instances of the XML class).
See Also
The XML class; “Superclasses and Subclasses,” in Chapter 12
XMLSocket Class
support for a persistent client/server TCP/IP connection
Flash 5
Constructor
new XMLSocket()
Table R-28. XMLNode and XML properties, methods, and event handlers
XMLNode and XML XML only
appendChild()
contentType
attributes
createElement()
childNodes createTextNode()
cloneNode()
docTypeDecl
firstChild
getBytesTotal()
hasChildNodes() getBytesLoaded()
insertBefore()
ignoreWhite
lastChild
load()
nextSibling loaded
nodeName
onData()
nodeType onLoad()
nodeValue parseXML()
parentNode send()
previousSibling sendAndLoad()
removeNode()
status
toString() xmlDecl