Hello,

Lovin' Flash MX however I'm having a tough time
getting it to work as a Jabber client. I'm running
Jabberd server 1.42 on Win2K Server.

Below the .as script (it's fla is simply a connect and
disconnect button with a text field) has two bugs,
please let me know what you think...

1) When I comment out 
//_root.jabberSocket.send(this.node_stream); 

then click connect there is a successful connection to
the server. However if I click disconnect the close()
function does not activate _root.jabberSocket.onClose.

My current workaround is to add
delete {_root.jabberSocket);

2) With 
_root.jabberSocket.send(this.node_stream); 

active I click on connect and immediately
_root.jabberSocket.onClose is called and now the
client is disconnected from the server. 

Mind you I haven't called close(), why is the jabber
server closing the socket on it's own?

Thank you in advance.

Rick


function connect() {
        if(!_root.jabberSocket){
                // Create new XMLSocket object
                _root.jabberSocket = new XMLSocket();
                _root.myVars = new Object();
                _root.myVars.serverName = "myServer.com";
                _root.myVars.serverPort = 5222;
                
                _root.jabberSocket.connect(_root.myVars.serverName,
_root.myVars.serverPort);
        
                _root.jabberSocket.onXML = newXML;
                _root.jabberSocket.onConnect = newConnection;
                _root.jabberSocket.onClose = disconnectedConnection;
                _root.status.text = "waiting";
                
        }else{
                _root.status.text = "still connected";
        }
}

function newConnection (success) {
        if (success) {
                _root.status.text = "connected!";
                
                // prepare and send in log in info
                this.node_stream = new XML();
                this.node_stream.xmlDecl = '<?xml version="1.0"
encoding="UTF-8"?>';
        this.node_stream =
this.node_stream.createTextNode('<flash:stream
to="'+_root.myVars.serverName+'" xmlns="jabber:client"
xmlns:flash="http://www.jabber.com/streams/flash";
/>');
        _root.jabberSocket.send(this.node_stream);
                        
        }
        else {
                _root.status.text = "error connecting";
        }
}

function closeConnection(){
        _root.jabberSocket.send("</flash:stream>");
        _root.jabberSocket.close();
        delete(_root.jabberSocket);
}

function disconnectedConnection () {
        _root.status.text = "disconnected";
}

THE END



function newXML (input) {
        // convert XML object to string
        _root.status.text = input.toString();
}

stop();



__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/
_______________________________________________
jdev mailing list
[EMAIL PROTECTED]
http://mailman.jabber.org/listinfo/jdev

Reply via email to