sketchbookshark
asked on
AS 3 my URLLoader returns the value 0 as HTTPStatusEvent.HTTP_STATUS other times works fine
I have a log-in a flash Movie. The flash Movie corresponds with the Server via URLLoader that calls a php page. When I run it locally it works fine, when I run it from the server it works in some browsers and other only sometimes or never.When it doesn;t work my HTTPStatusEventListener returns 0 as event.status. I do not get an IOError or a Security Error. I am at a loss. Here is my Code:
var logInRequest:URLRequest;
var logInLoader:URLLoader;
var URLSheet:AofF_URLCentral = new AofF_URLCentral;
var famousVet:URLVariables = new URLVariables();
function REGISTER(e:MouseEvent):void{
famousVet.evFirstName = logInUI.firstName.textBox.text;
famousVet.evLastName = logInUI.lastName.textBox.text;
famousVet.evEmail = logInUI.eMail.textBox1.text + "@" + logInUI.eMail.textBox2.text;
logInRequest = new URLRequest(URLSheet.getUserIDURL)
logInRequest.method=URLRequestMethod.POST;
logInRequest.data =famousVet;
logInLoader = new URLLoader()
configureListeners(logInLoader);
try{
logInLoader.load(logInRequest);
}
catch (e:Error){
if(tlTracking == true){
timeLTracker.textBox.appendText("Error detected" + e.toString());
}//end of IF
}
}//end of Funtion REGISTER
function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE,CompleteHandlerID);
dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR,securityErrorHandler);
dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS,httpStatusHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR,ioErrorHandler);
}//end of configure Listener
function CompleteHandlerID(event:Event):void {
yaddiyaddiyadda
}// end of function CompleteHandlerID
function securityErrorHandler(event:SecurityErrorEvent):void {
if (tlTracking == true){
timeLTracker.textBox.appendText("\nErrorCode : 166 / Flash ErrorMsg:" + error.toString());
}
}//end of privat function securityErrorHandler
function httpStatusHandler(e:HTTPStatusEvent):void {
if (tlTracking == true){
timeLTracker.textBox.appendText("\nHTTPSTatus:" + e.status );//this is where it returns 0
}//end of IF
}//end of hhtpStatusHandler
function ioErrorHandler(event:IOErrorEvent):void {
trace("ioErrorHandler: " + event );
if (tlTracking == true){
timeLTracker.textBox.appendText("Ein Fehler ist aufgetreten. \n\nErrorCode: 178");
}//end of IF
}//end of ioErrorHandler
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Your crosssdomain.xml file should be on remote host not on local.
You have to create this file and upload to webhost root directory
Try to access to this file via browser
http://remotehost.com/crossdomain.xml
You have to create this file and upload to webhost root directory
Try to access to this file via browser
http://remotehost.com/crossdomain.xml
ASKER
OK. the problem is fixed.
Thank you very much for your help in explaining the Status Event. That's what got me on the right trail.
Since I did not have privileges to place anything in the root of the domain, the crossdomain.xml was not a possible solution.
What did fix the problem was a relative path in my URL, which eliminated the "http://www". Once that was gone the whole thing worked like a charm. So I am now going one level up and then into the php folder:
Thank you very much for your help in explaining the Status Event. That's what got me on the right trail.
Since I did not have privileges to place anything in the root of the domain, the crossdomain.xml was not a possible solution.
What did fix the problem was a relative path in my URL, which eliminated the "http://www". Once that was gone the whole thing worked like a charm. So I am now going one level up and then into the php folder:
var URL:String"../php/my_php_page.php"
Thanks sketchbookshark,
I will glad if you will provide some points for my time :)
I will glad if you will provide some points for my time :)
ASKER
I had been searching for an interpretation of that HTTPStatusEvent.status. This is very well explained.
In the meantime I have more information. I installed firebug and it turns out i get a 404 because flash is looking for the crossdomain.XML, which I didn't write, because it's in the same Domain. Could it be that I should not have "http://" in the URL for it to recognize the URL as sameDomain?
If I do have to create a crossdomain.xml, where should that be saved?