Objective: When a visitors attemps to do something using my flash site that produces an error, this class will catch the error and store the date and error message into a mySQL database via PHP.
The original file is resource.xml. I changed it to resourcex.xml to test out my error log feature.
Related AS:
var resourceFile:URLRequest = new URLRequest("resourcex.xml");
var resource:URLLoader = new URLLoader();
var resourceName:String = "Console Resource";
var resourceData:XML;
var handlerFile:URLRequest = new URLRequest("errorhandler.php");
var variables:URLVariables = new URLVariables();
var report:URLLoader = new URLLoader();
var errorMsg:String;
var adminEmail:String;
var $output:TextField;
public function Resource(OUTPUT:TextField){
$output = OUTPUT
resource.addEventListener(IOErrorEvent.IO_ERROR, resourceFail);
resource.load(resourceFile);
}
function resourceFail(event:IOErrorEvent){
errorMsg = "Resource - "+ event.text;
reportError(new Date(), errorMsg);
$output.appendText(errorMsg+" > File Error Occured");
trace(errorMsg);
}
public function reportError(DATE:Date, STRING:String){
variables.timestamp = DATE;
variables.output = STRING;
handlerFile.method = URLRequestMethod.POST;
handlerFile.data = variables;
report.dataFormat = URLLoaderDataFormat.VARIABLES;
report.load(handlerFile);
}
Problem:
Running the SWF from the Flash IDE generates this error:
*Resource - Error #2032: Stream Error. URL: file:///E|/Projects/Personal/Gods%20Phoenix/website/public%5Fhtml/kasai/engine/resourcex.xml.
*This is in both the IDE output and in the $output textField within the Movie. This entire line is reported to the database when I use an absolute link to the errorhandler.php server page.
Running the SWF itself and when embedded in html from the website generates this:
*Resource - Error #2032
*This is the only info I get displayed in the text field and in the database.
I tried the URLRequsets with both relative paths and absolute links from my domain address, with a crossdomain.xml of course.
I know IE on windows is about the only browser that will relay http status code. But this info is, I think, is supposed to be generated from flash itself and not the server. Any help is very much appreaciated.