EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Page 704

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
704 ActionScript classes
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
LoadVars object. (Notice that this example creates the instance members
this.httpStatus
and
this.httpStatusType at runtime.) The onData method uses these instance members to
trace information about the HTTP response that can be useful in debugging.
var myLoadVars:LoadVars = new LoadVars();
myLoadVars.onHTTPStatus = function(httpStatus:Number) {
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";
}
}
myLoadVars.onData = function(src:String) {
trace(">> " + this.httpStatusType + ": " + this.httpStatus);
if(src != undefined) {
this.decode(src);
this.loaded = true;
this.onLoad(true);
}
else {
this.onLoad(false);
}
}
myLoadVars.onLoad = function(success:Boolean) {
}
myLoadVars.load("http://weblogs.macromedia.com/mxna/flashservices/
getMostRecentPosts.cfm");

Table of Contents

Related product manuals