149
A
APPENDIX A
Client-Side Information
Objects
The Camera, Microphone, LocalConnection, NetConnection, NetStream, and SharedObject
objects provide an
onStatus
event handler that uses an information object for providing
information, status, or error messages. To respond to this event handler, you must create a
function to process the information object, and you must know the format and contents of
the information object returned.
In addition to the specific
onStatus
handlers provided for the objects listed above,
Macromedia Flash also provides a super function called
System.onStatus
. If
onStatus
is
invoked for a particular object with a level property of
error
and there is no function
assigned to respond to it, Flash processes a function assigned to
System.onStatus
if it exists.
The following example illustrates how you can create generic and specific functions to process
information objects sent by the
onStatus
method:
// Create generic function.
System.onStatus = function(genericError)
{
// Your script would do something more meaningful here.
trace("An error has occurred. Please try again.");
};
// Create connection functions.
/* If the connection attempt returns a different information object from
those listed below, with a level property of "error", System.onStatus
will be invoked. */
nConn.onStatus = function(infoObject)
{
if (infoObject.code == "NetConnection.Connect.Success")
{
trace("Successful connection.");
}
if (infoObject.code == "NetConnection.Connect.Failed")
{
trace("Connection failed.");
}
};