When a socket connetion is closed remotely and socketClosed() is called, it is simply dispatching a DisconnectionEvent event. Shouldn’t active and loggedIn be set as false, since the socket is no longer connected and the user must connect again to reestablish connectivity?
I propose making the following change
protected function socketClosed(event:Event):void
active = false;
loggedIn = false;
var disconnectionEvent:DisconnectionEvent = new DisconnectionEvent();
dispatchEvent( disconnectionEvent );
we do not have to call socket.close() since we are already assured that the connection has been closed remotely. This more correctly reflects the state of the connection.