Added the CLIENT_DID_CLEAR client event.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4284 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-07-21 23:41:12 +00:00
parent e16d838b18
commit a9109fc4af
3 changed files with 21 additions and 0 deletions
@@ -57,6 +57,8 @@ public class Client extends EventDispatcher
cliObs.clientConnectionFailed);
addEventListener(ClientEvent.CLIENT_WILL_LOGOFF,
cliObs.clientWillLogoff);
addEventListener(ClientEvent.CLIENT_DID_CLEAR,
cliObs.clientDidClear);
}
}
@@ -81,6 +83,8 @@ public class Client extends EventDispatcher
cliObs.clientConnectionFailed);
removeEventListener(ClientEvent.CLIENT_WILL_LOGOFF,
cliObs.clientWillLogoff);
removeEventListener(ClientEvent.CLIENT_DID_CLEAR,
cliObs.clientDidClear);
}
}
@@ -325,6 +329,8 @@ public class Client extends EventDispatcher
// another port, or something
if (logonError != null) {
notifyObservers(ClientEvent.CLIENT_FAILED_TO_LOGON, logonError);
} else {
notifyObservers(ClientEvent.CLIENT_DID_CLEAR, null);
}
}
@@ -12,6 +12,7 @@ public class ClientEvent extends Event
* preventDefault() on this event. */
public static const CLIENT_WILL_LOGOFF :String = "clientWillLogoff";
public static const CLIENT_DID_LOGOFF :String = "clientDidLogoff";
public static const CLIENT_DID_CLEAR :String = "clientDidClear";
public function ClientEvent (type :String, client :Client,
cause :Error = null)
@@ -31,6 +32,11 @@ public class ClientEvent extends Event
return _cause;
}
override public function clone () :Event
{
return new ClientEvent(type, _client, _cause);
}
/** The client that generated this client event. */
protected var _client :Client;
@@ -76,5 +76,14 @@ public interface ClientObserver extends SessionObserver
* calls event.preventDefault() then it will abort the logoff request.
*/
function clientWillLogoff (event :ClientEvent) :void;
/**
* Called after the client is completely logged off from a successful
* session and is ready to reconnect to a new server if desired. This will
* only be called after an active session was terminated, not after a logon
* attempt failed as that failure will be reported by {@link
* #clientFailedToLogon}.
*/
function clientDidClear (event :ClientEvent) :void;
}
}