
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
138
Parameters
httpStatus A number; the HTTP status code returned by the server. For example, a value of 404 indicates that
the server has not found a match for the requested URI. HTTP status codes can be found in sections 10.4 and 10.5
of the HTTP Specification at ftp://ftp.isi.edu/in-notes/rfc2616.txt.
Example
The following example shows how to use
onHTTPStatus() to help with debugging. The example collects HTTP
status codes and assigns their value and type to an instance of the XML object. (This example creates the instance
members
this.httpStatus and this.httpStatusType at runtime.) The onData() handler uses these instance
members to trace information about the HTTP response that can be useful in debugging.
var myXml = new XML();
myXml.onHTTPStatus = function(httpStatus) {
this.httpStatus = httpStatus;
if(httpStatus < 100) {
this.httpStatusType = "flashError";
}
else if(httpStatus < 200) {
this.httpStatusType = "informational";
}
else if(httpStatus < 300) {
this.httpStatusType = "successful";
}
else if(httpStatus < 400) {
this.httpStatusType = "redirection";
}
else if(httpStatus < 500) {
this.httpStatusType = "clientError";
}
else if(httpStatus < 600) {
this.httpStatusType = "serverError";
}
};
myXml.onData = function(src) {
trace(">> " + this.httpStatusType + ": " + this.httpStatus);
if(src != undefined) {
this.parseXML(src);
this.loaded = true;
this.onLoad(true);
} else {
this.onLoad(false);
}
};
myXml.onLoad = function(success) {
// Insert code here.
}
myXml.load("http://weblogs.macromedia.com/mxna/xml/rss.cfm?query=byMostRecent&languages=1"
);
See also
LoadVars.onHTTPStatus(), XML.send(), XML.sendAndLoad()
Komentarze do niniejszej Instrukcji