Код: Выделить всё
var socket:XMLSocket = new XMLSocket();
socket.onXML = xmlReceived;
socket.onConnect = function(success:Boolean) {
if (success) {
speedz.text = "Connection succeeded!" ;
src = "info\n";
socket.send(src);
socket.onData();
} else {
speedz.text = "Connection failed!";
}
};
if (!socket.connect("10.0.254.230", 1667)) {
_root.speedz.text = "Connection failed!";
}
socket.onClose = function(){
speedz.text = "Closed!";
}
socket.onData = function(src) {
speedz2.text = src;
};
function xmlReceived (data) {
var e = data.firstChild;
if (e != null && e.nodeName == "MESSAGE"){
displayMessage(e.attributes.user, e.attributes.text);
speedz1.text = "dat " + e.attributes.text;
}
}