System.onStatus 663
System.onStatus
Availability
Flash Player 6.
Description
Event handler: provides a “super” event handler for certain objects.
The LocalConnection, 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 methods provided for the objects listed above, 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.
Note: The Camera and Microphone classes also have onStatus handlers, but do not pass information
objects with a level property of "error". Therefore,
System.onStatus is not called if you don’t specify a
function for these handlers.
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 function for NetStream object
// If the NetStream object returns a different information object
// from the one listed below, with a level property of "error",
// System.onStatus will be invoked
videoStream_ns.onStatus = function(infoObject) {
if (infoObject.code == "NetStream.Play.StreamNotFound") {
trace("Could not find video file.");
}
}
See also
Camera.onStatus
, LocalConnection.onStatus, Microphone.onStatus, NetStream.onStatus,
SharedObject.onStatus