Debugging and Monitoring Applications > Using onStatus event handlers > Overriding onStatus

 

Overriding onStatus

One of the first things your application should do, even if you don't need to do anything in the onStatus handler, is to override the generic onStatus handler for all of the Flash Communication Server objects. One strategy is to override the onStatus handler when you start writing the application, as shown in the following example:

// Trace all the status info
function traceStatus(info) {
	trace("Level: " + info.level + "   Code: " +  info.code);
}
NetConnection.prototype.onStatus = traceStatus;
NetStream.prototype.onStatus = traceStatus;
SharedObject.prototype.onStatus = traceStatus;

As you develop your application and determine that you need to actually override the handler for a specific purpose, you can delete the code above, but in the meantime you will at least see all of the messages related to your application.

Always check for status messages on both the client and server.