function myOnConnect(success){ if(success) trace("success"); else trace("failed"); } function newXML(input){ var receivedText = input.toString(); trace(receivedText); var e = input.firstChild; if (e != null) { if (e.nodeName eq "e"){ _root.user=e.attributes.user; _root.msg=e.attributes.msg; } } } socket = new XMLSocket(); socket.onConnect = myOnConnect; socket.onXML = newXML; if(!socket.connect("class.sva.edu",4001)){ trace("connection failed"); } // in the button on(press){ var myXML = new XML(); var myE = myXML.createElement("e"); myE.attributes.user = _root.usernameTextField; myE.attributes.msg = _root.messageTextField; myXML.appendChild(myE); _root.socket.send(myXML); }